Automatic comment and model training method and system, medium and equipment
By iterative training and fine-tuning of large language models, combined with social media comment data, the problem of accuracy of generating comments in the existing technology is solved, and the automatic generation of high-quality comments is realized, which improves user stickiness and activity, and passes quality Control ensures controllability and credibility of content.
Patent Information
- Application Number
- CN202410912145.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-11-22
AI Technical Summary
When existing large language models automatically generate social network platform comments, the accuracy of the generated results is poor and cannot meet the comment needs of users for posting content.
Using the automatic comment method based on the large language model, select samples that meet the preset quantity requirements as the sample set, determine the comment attributes, and iteratively train the large language model, combine the model fine-tuning technology, and use comment data on social media such as Weibo. Carry out training to ensure that the generated comments meet output limitations and quality control.
It realizes the generation of high-quality, complete and interesting comment reply texts, improves user stickiness and activity, and ensures content controllability and credibility through quality control models.
Smart Images

Figure CN119003713A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology, and in particular to an automatic comment method and device based on a large language model. Background Art
[0002] In order to increase the enthusiasm of user interaction within social networking platforms such as Weibo, the system often needs to automatically generate some information and display it to users as auxiliary reference. For example, the system can provide an automatically predicted expression material related to the published content in the edit box based on the input comment flow, and the user can confirm whether to add the expression material to facilitate the rapid publication of comments. In order to further improve user stickiness and activity, the industry generally hopes to achieve fully automated comment publishing for user-published content, and even interact with users to comment and reply to the published content.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] In the prior art, there are deep learning-based natural language processing (NLP) technologies such as large language models (LLMs), which can be used to understand and generate natural language. However, the accuracy of natural language generated by these large language models is poor, and the generated results often deviate greatly from expectations, and cannot be applied to social network platforms to automatically generate comments on user-posted content (such as blog posts). Therefore, how to accurately and automatically generate comments on user-posted content is a problem that needs to be solved. Summary of the invention
[0005] The embodiment of the present invention provides an automatic comment method and system based on a large language model, which is used to accurately and automatically generate comments on content posted by users, thereby improving user stickiness and activity.
[0006] To achieve the above-mentioned purpose, on the one hand, an embodiment of the present invention provides a model training method for automatic commenting, comprising: selecting samples that meet a first preset number requirement as a sample set, and determining the comment attributes of each sample, wherein each sample at least includes user-posted content and comment content for the user-posted content, and the comment attributes are used to characterize the attribute characteristics of the comment content in the sample that conform to the set classification rules; using the sample set to perform model iterative training on a large language model until a preset convergence condition is reached to obtain an applicable large language model; wherein the specific steps of each model iterative training of the large language model include: determining the training input text of the large language model based on the user-posted content in the sample, using the comment attributes of the sample as an output limiting condition, and obtaining the automatic comment prediction content output by the large language model that conforms to the output limiting condition; using the comment content in the sample as a label, determining a loss function value according to the automatic comment prediction content and the label, and adjusting the model parameters of the large language model according to the loss function value, wherein the loss function value is used to characterize the difference between the automatic comment prediction content and the label.
[0007] At the same time, an embodiment of the present invention provides an automatic comment method, including: obtaining user-posted content to be commented on, and determining the comment attributes to be automatically generated for the user-posted content; determining the input text to which a large language model can be applied based on the user-posted content to be commented on, using the comment attributes to be automatically generated as output limiting conditions, and obtaining automatic comments that meet the output limiting conditions and can be output by a large language model that can be applied; the applicable large language model is trained using the aforementioned model training method; and the generated automatic comments are published as a simulated commentator.
[0008] On the other hand, an embodiment of the present invention provides a model training system for automatic commenting, including: a sample selection module, used to select samples that meet a first preset number requirement as a sample set, and determine the comment attributes of each sample, wherein each sample at least includes user-posted content and comment content for the user-posted content, and the comment attributes are used to characterize the attribute characteristics of the comment content in the sample that conform to the set classification rules; a model training module, used to use the sample set to perform model iterative training on a large language model until a preset convergence condition is reached to obtain an applicable large language model; wherein the model training module is specifically used to: determine the training input text of the large language model based on the user-posted content in the sample, use the comment attributes of the sample as an output limiting condition, and obtain the automatic comment prediction content output by the large language model that conforms to the output limiting condition; use the comment content in the sample as a label, determine the loss function value according to the automatic comment prediction content and the label, and adjust the model parameters of the large language model according to the loss function value, wherein the loss function value is used to characterize the difference between the automatic comment prediction content and the label.
[0009] Furthermore, an embodiment of the present invention also provides an automatic comment system, including: an automatic comment generation module, used to obtain user-posted content to be commented on, and determine the attributes of the comments to be automatically generated for the user-posted content; based on the user-posted content to be commented on, determine the input text to which the large language model can be applied, use the attributes of the comments to be automatically generated as output limiting conditions, and obtain automatic comments that meet the output limiting conditions and can be output by the large language model; the applicable large language model is trained using the aforementioned model training method; and a publishing module is used to publish the generated automatic comments as a simulated commentator.
[0010] At the same time, an embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it implements the aforementioned model training method for automatic commenting and / or implements the aforementioned automatic commenting method.
[0011] In addition, an embodiment of the present invention also provides a computer device, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by one or more processors, the one or more processors implement the aforementioned model training method for automatic commentary, and / or implement the aforementioned automatic commentary method.
[0012] The above technical solution has the following beneficial effects:
[0013] In this technical solution, a large language model and model fine-tuning technology are combined to make full use of a large amount of comment data collected from social media such as Weibo as training samples. At the same time, the samples are carefully decomposed, and specific comment attributes are decomposed for each sample according to preset classification rules. The comment attributes are then filled into instruction templates to participate in training, which makes it convenient for the model to control content and ensure the optimal model generation effect, thereby realizing single-round and multi-round automatic commenting and automatic publishing, generating high-quality, complete, and interesting comment reply texts, and effectively improving user stickiness and activity.
[0014] In addition, this technical solution also adds quality control models upstream and downstream of the Dada language model to ensure the quality and safety of the entire link, fully ensuring that the final effect of the entire technical solution is controllable in content and reliable in quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1is a flow chart of a model training method for automatic commenting according to an embodiment of the present invention;
[0017] Figure 2 is a flow chart of an automatic comment method according to an embodiment of the present invention;
[0018] Figure 3 It is a structural diagram of a model training system for automatic review according to an embodiment of the present invention;
[0019] Figure 4 is a structural diagram of an automatic comment system according to an embodiment of the present invention;
[0020] Figure 5 It is a schematic diagram of a specific embodiment of the present invention. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] like Figure 1 As shown, an embodiment of the present invention provides a model training method for automatic commenting, comprising:
[0023] S101, selecting samples that meet a first preset number requirement as a sample set, and determining a comment attribute of each sample, wherein each sample includes at least user-posted content and comment content for the user-posted content, and the comment attribute is used to characterize the attribute characteristics of the comment content in the sample that conform to a set classification rule;
[0024] S102, using the sample set to perform model iterative training on the large language model until a preset convergence condition is reached to obtain an applicable large language model;
[0025] The step S102 specifically includes:
[0026] Determine the training input text of the large language model based on the user-published content in the sample, use the comment attribute of the sample as an output limiting condition, and obtain the automatic comment prediction content output by the large language model that meets the output limiting condition;
[0027] The comment content in the sample is used as a label, a loss function value is determined according to the automatic comment prediction content and the label, and the model parameters of the large language model are adjusted according to the loss function value, wherein the loss function value is used to characterize the difference between the automatic comment prediction content and the label.
[0028] To solve the aforementioned problems, in this technical solution, a robot automatic comment function is added to the network system of social platforms such as Weibo, and a comment robot (or simulated commentator) is created with the help of large language model technology. The comment robot will interact with users in a single or multiple rounds of comment replies in an interesting style, thereby improving user stickiness and activity.
[0029] To achieve this function, in this technical solution, the GLM large language model is used as the base model to achieve automatic comment and reply interaction. The large language model is the GLM model, and the supervised fine-tuning method is the SFT fine-tuning technology.
[0030] Large Language Models (LLMs) are a natural language processing (NLP) technology based on deep learning, usually using a Transformer architecture and trained with large amounts of text data. These models can understand and generate natural language and are widely used in fields such as text summarization and machine translation. The main function of LLMs is to calculate the probability of a word given an input sentence. They are trained using self-supervised learning techniques, which use the inherent structure of the data itself to generate learning examples for training labels. During the training process, the model traverses a large amount of training sample data, learns to identify and internalize the inherent connections between various language patterns, and thus creates an internal representation of the language.
[0031] The GLM model is an open-source universal base for large language models in Chinese and English. Compared with other large language models such as GPT and LLAMA, which are autoregressive structures, GLM is an autoencoder-autoregressive structure and uses a 2D encoding technique to represent inter- and intra-span information. Specifically, it is a universal pre-training framework based on an autoregressive blank-filling objective. GLM converts the content understanding (NLU) task into a cloze problem containing a task description, which can be answered in an autoregressive generation manner. The autoregressive blank-filling objective refers to randomly removing some continuous text fragments from the input text, and then training the model to reconstruct these fragments in any order. The cloze problem refers to replacing one or more words in the input text with a special symbol, and then training the model to predict the replaced words.
[0032] SFT (supervised fine-tuning) is a supervised fine-tuning technique based on LLM, which aims to further improve the performance and adaptability of LLM. In this application, SFT is used to fine-tune the LLM base model so that the model can adapt to the language patterns and rules of a specific task or data set. SFT technology generally refers to fine-tuning LLM using a small amount of labeled data to adapt to the language patterns and rules of a specific task. SFT technology can significantly improve the performance and adaptability of LLM, enabling the model to better handle natural language processing tasks. At the same time, SFT technology also requires certain computing resources and time costs, and different fine-tuning strategies may be required for different tasks and data sets. Therefore, a sufficient amount of training data (for example, 2 million) needs to be constructed in advance to fine-tune the open source GLM base model, so that sufficiently good results can be obtained with limited resources and training time.
[0033] In actual application, a sufficient number of training samples should be collected, and the open source GLM base model should be fine-tuned with SFT (supervised fine-tuning) technology, so as to obtain sufficiently good results with limited resources and training time. In the process of model training, in order to accurately match the content published by users (such as blog posts published on platforms such as Weibo), and generate comments that are closer to user characteristics, this technical solution also assigns one or more attributes to the user's published content and the comments to be automatically generated according to multiple different dimensions; after the subsequent model is put into use, the preset attribute classification rules are still used to specify the attributes of the comments to be automatically generated, thereby effectively ensuring the accuracy of the automatic comments, making them closer to user needs, and achieving the purpose of improving user stickiness and activity.
[0034] Combining large language models with model fine-tuning technology, we fully utilize the large amount of comment data collected from social media such as Weibo as training samples, and at the same time, we carefully disassemble the samples and fill in the instruction templates based on the disassembled attributes to participate in the training. This allows the initial input text of the model training to include both the original text of the user's posting and its specific attributes, making it easier for the model to control content and ensuring the best model generation effect. At the same time, we use the comment content in the sample as a label for the training process so that it can be compared word by word with the model output results, thereby continuously adjusting the model parameters so that it can eventually be put into use.
[0035] During the model training process, according to the working principle of the large language model, for each training sample, the initial input text for model training (excluding the comment content in the sample) needs to be input first, and the large language model predicts the first predicted word, and compares the first predicted word with the first token in the label (for example, when the label is a sentence, each token is a word arranged in word order), and calculates the loss function based on the comparison result; then, the first token in the label is added to the initial input text for model training to form the input text for model training in the second step, so that the large language model predicts the second predicted word, and compares it with the second token in the label again, and calculates the loss function based on the comparison result; then, the second token in the label is added to the input text for model training in the second step to form the input text for model training in the third step..., and the above steps are repeated until the large language model gradually outputs all tokens and can be spliced into words or sentences as the prediction result.
[0036] Furthermore, the types of samples in the sample set include: single-level interaction samples, and multi-level interaction samples composed of multi-level interaction contents, wherein the first-level interaction contents of the multi-level interaction samples include initial user-posted content and commentary contents for the initial user-posted content, and the other levels of interaction contents of the multi-level interaction samples include reply contents posted by the user for commentary contents of the previous level and commentary contents for reply contents of the current level; the single-level interaction contents of the single-level interaction samples include user-posted content and commentary contents for the user-posted content;
[0037] In each model iteration training process, when the current input sample is a multi-level interactive sample, the model training is performed layer by layer on the current input sample.
[0038] The above process can realize automatic commenting on the content posted by the user, that is, a single-round interaction process. In actual application, there is usually a multi-level (or multi-round) interaction process, that is, after the publisher sees the comment, he will reply to the comment (or called the secondary user posting content), and the commentator will comment again on the reply content (or called the secondary comment content)... In this way, the interaction between the publisher and the commentator is realized. To this end, in this technical solution, how to train multi-level interaction samples and how to realize multi-level interaction after the subsequent model is put into operation are also designed. During the training process, the number of multi-level interactions between the comment robot and the publisher can be set. After that, in the initial input text of the model training, in addition to the user posting content and the disassembled attributes, it also includes the publisher's secondary user posting content and other secondary user comment content other than the last secondary user comment content, and the last secondary user comment content is used as a label. In this way, through training, the large language model can master the comment generation method within the specified number of interactions, so that multiple rounds of interaction can be carried out after the online application.
[0039] Furthermore, the model training for the currently input sample is performed layer by layer, specifically including:
[0040] For the currently input sample, model training is started from the first level, and after the model training of each level is completed, the model training of the next level is started until the model training of the last level is completed; wherein, in the model training process of the first level, the user-published content in the first level interactive content is used as the training input text, and the comment content in the first level interactive content is used as the label, and in the model training of other levels, the user's reply content to the comment content of the previous level and the interactive content of each level before the current level are used as the training input text, and the comment content to the reply content of the current level is used as the label.
[0041] For the sample data of a single round of interaction, the user's published content (such as a blog post) is used as the training input text, and the corresponding comment content is used as the training output text. For the sample data of multiple rounds of interaction, the maximum number of splicing context dialogue windows can be limited to 5 (window_size=5), that is, the training output text is the current comment content, and the initial input text of the model training is the blog post and the comments replied to by the current comment at most 3.
[0042] Furthermore, the comment attributes include at least one of the following attributes:
[0043] Style attributes, used to characterize the image characteristics set for the simulated reviewer;
[0044] Sentiment attribute, which is used to characterize the simulated reviewer's attitude toward the content posted by the user being reviewed;
[0045] Type attribute, used to indicate the set type to which the comment content belongs;
[0046] The stance attribute is used to characterize whether the simulated commentator supports the content posted by the user being commented on;
[0047] The identity attribute is used to characterize the relationship between the simulated commentator and the user who posted the content to be commented on.
[0048] Specifically, according to the style attributes (or personality style attributes), it can be divided into categories such as humor, professional science, etc. According to the relationship between the comment robot and the user (the publisher of the user's content), it can be divided into friends and officials. According to the emotional attitude, it can be divided into positive, negative, neutral and other categories. According to the subjective attitude, it can be divided into two positions: support and opposition. According to the type, it can also be divided into sharing, ridicule, blessing, discussion and other categories. With such independent characterization of different dimensions, different dimensions of training data can be cross-combined to determine the comment attributes of each sample; when the application is launched online, the same method can be used to determine the attributes of automatic comments, and the attributes can be used to limit the content of automatic comments to make them more accurate and closer to users.
[0049] like Figure 2 As shown, an embodiment of the present invention provides an automatic comment method, including:
[0050] S201, obtaining user-posted content to be commented on, and determining the attributes of the comments to be automatically generated for the user-posted content; determining the input text to which the large language model can be applied based on the user-posted content to be commented on, using the attributes of the comments to be automatically generated as output limiting conditions, and obtaining the automatic comments that meet the output limiting conditions output by the applicable large language model; the applicable large language model is trained using the aforementioned model training method;
[0051] S202: Publish the generated automatic review in the identity of a simulated reviewer.
[0052] Furthermore, the method further comprises:
[0053] S203, before the applicable large language model outputs the automatic comment that meets the output restriction condition, determining whether the input text has comment value through a pre-trained first filtering model; wherein the first filtering model is used to determine whether the input text to which the applicable large language model is applicable has comment value; and / or,
[0054] S204. Before publishing the generated automatic comment as a simulated commentator, determine whether the generated automatic comment is a friendly comment through a pre-trained second filtering model, and determine whether the content relevance between the generated automatic comment and the user-posted content to be commented on meets the requirements through a pre-trained third filtering model; wherein the second filtering model is used to determine whether the automatic comment is a friendly comment, and the third filtering model is used to determine whether the content relevance between the automatic comment and the user-posted content to be commented on meets the requirements.
[0055] In view of the business sensitivity of social networks such as Weibo, this technical solution also designs a pre-filtering model (i.e., the first filtering model) and a post-filtering model (i.e., the second filtering model and the third filtering model) to perform quality control on the content (e.g., blog posts) published by users to be commented on, and to perform quality control and consistency detection on the automatic comments that have been generated but not yet published, so as to improve the quality credibility. The pre-filtering model and the post-filtering model can adopt the Bert structure and other models of the existing technology.
[0056] Furthermore, the user-posted content to be commented on includes: initial user-posted content, or reply content posted by the user to any automatic comment;
[0057] The step S201 specifically includes: when the user-posted content to be commented on is the initial user-posted content, using the initial user-posted content as the input text for the first round of the applicable large language model; after the automatic comments generated by the posting are generated, when the reply content posted by the user to the automatic comments is received, the input text of the previous round, the automatic comments generated in the previous round, and the reply content are spliced as the input text for a new round of the applicable large language model.
[0058] like Figure 3 As shown, an embodiment of the present invention further provides a model training system for automatic commenting, comprising:
[0059] The sample selection module 31 is used to select samples that meet the first preset number requirement as a sample set, and determine the comment attribute of each sample, wherein each sample at least includes user-posted content and comment content for the user-posted content, and the comment attribute is used to characterize the attribute characteristics of the comment content in the sample that conform to the set classification rules;
[0060] A model training module 32, configured to perform iterative model training on the large language model using the sample set until a preset convergence condition is reached to obtain an applicable large language model;
[0061] Among them, the model training module 32 is specifically used to: determine the training input text of the large language model based on the user-published content in the sample, use the comment attributes of the sample as output limitation conditions, and obtain the automatic comment prediction content output by the large language model that meets the output limitation conditions; use the comment content in the sample as a label, determine the loss function value according to the automatic comment prediction content and the label, and adjust the model parameters of the large language model according to the loss function value, wherein the loss function value is used to characterize the difference between the automatic comment prediction content and the label.
[0062] Furthermore, the types of samples in the sample set include: single-level interaction samples, and multi-level interaction samples composed of multi-level interaction contents, wherein the first-level interaction contents of the multi-level interaction samples include initial user-posted content and commentary contents for the initial user-posted content, and the other levels of interaction contents of the multi-level interaction samples include reply contents posted by the user for commentary contents of the previous level and commentary contents for reply contents of the current level; the single-level interaction contents of the single-level interaction samples include user-posted content and commentary contents for the user-posted content;
[0063] The model training module 32 also includes a multi-level interaction training module 321, which is used to perform layer-by-layer model training on the currently input sample when the currently input sample is a multi-level interaction sample during each model iteration training process.
[0064] Furthermore, the multi-level interactive training module 321 is specifically used for:
[0065] For the currently input sample, model training is started from the first level, and after the model training of each level is completed, the model training of the next level is started until the model training of the last level is completed; wherein, in the model training process of the first level, the user-published content in the first level interactive content is used as the training input text, and the comment content in the first level interactive content is used as the label, and in the model training of other levels, the user's reply content to the comment content of the previous level and the interactive content of each level before the current level are used as the training input text, and the comment content to the reply content of the current level is used as the label.
[0066] Furthermore, the comment attributes include at least one of the following attributes: a style attribute, which is used to characterize the character image characteristics set for the simulated commentator; an emotion attribute, which is used to characterize the simulated commentator's attitude toward the user-posted content to be commented on; a type attribute, which is used to characterize the set type to which the comment content belongs; a stance attribute, which is used to characterize whether the simulated commentator supports the user-posted content to be commented on; and an identity attribute, which is used to characterize the relationship between the simulated commentator and the user who posted the user-posted content to be commented on.
[0067] like Figure 4 As shown, the embodiment of the present invention also provides an automatic comment system, including:
[0068] The automatic comment generation module 41 is used to obtain the user-posted content to be commented on, and determine the comment attributes to be automatically generated for the user-posted content; based on the user-posted content to be commented on, determine the input text to which the large language model can be applied, use the comment attributes to be automatically generated as output limiting conditions, and obtain the automatic comment that meets the output limiting conditions output by the applicable large language model; the applicable large language model is trained using the model training method described in any one of claims 1 to 4;
[0069] The publishing module 42 is used to publish the generated automatic comments in the identity of a simulated commentator.
[0070] Furthermore, the automatic comment system also includes:
[0071] The first filtering module 411 is used to determine whether the input text has comment value by using a pre-trained first filtering model before the applicable large language model outputs an automatic comment that meets the output restriction condition; wherein the first filtering model is used to determine whether the input text to which the applicable large language model is applicable has comment value; and / or,
[0072] The second filtering module 412 is used to determine whether the generated automatic comment is a friendly comment by using a pre-trained second filtering model before publishing the generated automatic comment as a simulated commenter; the second filtering model is used to determine whether the automatic comment is a friendly comment;
[0073] The third filtering module 413 is used to determine whether the content relevance between the generated automatic comments and the user-posted content to be commented on meets the requirements through a pre-trained third filtering model before the generated automatic comments are published as a simulated commentator; the third filtering model is used to determine whether the content relevance between the automatic comments and the user-posted content to be commented on meets the requirements.
[0074] Furthermore, the user-posted content to be commented on includes: initial user-posted content, or reply content posted by the user to any automatic comment;
[0075] The automatic comment generation module 41 is also specifically used for: when the user-posted content to be commented on is the initial user-posted content, using the initial user-posted content as the input text for the first round of the applicable large language model; after the automatic comments generated by the release are generated, when the reply content posted by the user to the automatic comments is received, the input text of the previous round, the automatic comments generated in the previous round, and the reply content are spliced as the input text for a new round of the applicable large language model.
[0076] The method of the present invention is described in detail below with a specific embodiment:
[0077] The technical solution structure of this specific embodiment is as follows Figure 5 As shown in the figure, it is applied to Weibo. The solution includes three major technical modules: data layer, model layer, and engineering layer, among which:
[0078] 1) Data layer:
[0079] In order to ensure that the large language model can fully learn the style of comments in the Weibo domain, understand the reply characteristics of data in various fields and the common network language habits, we selected the general high-quality comment area of the material library, the high-quality comment area in the field of entertainment stars, and the high-quality comment area of negative one screen ordinary users, etc., and used them as the training sample set.
[0080] For the sample data of a single round of interaction, the blog post (equivalent to the content published by the user) is used as the input text for training, and the corresponding comment content is used as the output text for training. For the sample data of multiple rounds of interaction, the maximum number of splicing context dialogue windows can be limited to 5 (window_size=5), that is, the training output text is the current comment content, and the initial input text for model training is the blog post and at most 3 comments replied to by the current comment. In this specific example, the sample set contains about 2 million training data (samples).
[0081] 2) Model layer:
[0082] 2.1) Model layer composition: including large language model GLM and supervised fine-tuning:
[0083] 2.2) Data disassembly and filling instructions to achieve controllable model content:
[0084] At the model level, it is decomposed into two modules according to the functional implementation, namely the large model fine-tuning module, and the quality control module (including the pre-filter model and the post-filter model). After collecting more than 2 million training sample data at the data level, in order to further achieve the controllable performance of generated content (that is, support for specifying personality, specified emotions, specified types, etc. in Prompt (prompt words) to make comment replies), it is necessary to decompose each of the full training data according to different dimensions. In the AI artificial intelligence large model, the role of Prompt is to prompt the AI large model with the context of input information, help the model better understand the intention of the input, and respond accordingly. In layman's terms, it is to provide an AI model with a "prompt" or "guidance" to help it better understand and complete the task. When in use, it is directly input into the GLM model; the entire sentence surrounded by quotation marks is used as model input.
[0085] Specifically, in this specific embodiment, the personality is divided into two categories: the personality style attributes are divided into four categories: supportive comments, humor, sharp ridicule, and professional science popularization; the personality relationship between the comment robot and the user is divided into friends and officials; the emotions are divided into two categories: according to the different emotional polarities, we divide the emotions into three categories: positive, negative, and neutral; according to the different subjective attitudes, they are divided into two categories: support and opposition; according to the type, we divide the training data into five categories: emotional sharing, playing jokes, praise and blessings, inquiries, and divergent discussions. With such independent characterization of different dimensions, the different dimensions of the training data can be cross-combined and constructed. The constructed example Prompt is as follows: "Please simulate the {personality style attribute} personality, the emotional type is {emotional polarity}, and write a comment reply to the blog post. The blog post is {blog post}. The comment is: ". The content in the brackets is filled with real data.
[0086] With the above template, fill in the training sample data, use this batch of data to perform SFT fine-tuning based on the GLM large language model base, the model parameter volume reaches 10B, and the Lora efficient fine-tuning method is used in the specific training. After 2 epochs (rounds) of iteration (an evaluation is performed after each epoch of training to see whether the expected effect is achieved and whether further training is needed; the 2 epochs are the actual values in this specific embodiment), a stable and usable large model for comment generation (i.e., a large language model that can be applied) is obtained.
[0087] 2.3) Multiple filtering models connected in series to ensure reliable quality
[0088] The second major module of the model layer is the quality control module. Before the large language model can be officially launched, three quality control models are trained using real manually annotated data collected from different businesses or real negative feedback data from users. They are all Bert structures and binary classification tasks. They are:
[0089] The pre-filtering model, i.e. the first filtering model, is used for pre-filtering before generating automatic comments. After receiving the content published by the user (Blog), it is used to filter out the blog posts with bad guidance tendencies such as advertising, traffic diversion, and war-provoking, and blog posts that are not worth replying. The output results of this model are two categories: pass and fail, based on which blog posts that are not worth commenting on can be discarded.
[0090] The second filtering model in the post-filtering model, after generating the automatic comments, classifies the generated automatic comments according to whether they are friendly, so as to filter out unfriendly comments that are not suitable for direct communication to users.
[0091] The third filtering model in the post-filtering model is used to classify the generated automatic comments according to whether they are consistent with the content discussed in the blog post after the automatic comments are generated, so as to filter out irrelevant low-quality comments.
[0092] The complete path of this module is: post a blog online, enter the pre-filtering model, then enter the large language model to generate automatic comments, and then enter the two post-filtering models. After passing all of them, it is considered that automatic comments that can be posted by comment robots have been generated.
[0093] 3) Engineering layer
[0094] The engineering layer includes several independent technical modules, including: comment risk control interface, comment automatic publishing tool, data reflow tool, etc. For the comment risk control interface, directly call the unified external output control interface to avoid security-sensitive risks. The comment automatic publishing tool is used to complete automatic calling and publishing of automatic comments after generating automatic comments, and display them to users. The data reflow tool will record the positive or negative status of users' likes, reposts, complaints, etc. on automatic comments, which is convenient for continuous training data iteration and model optimization.
[0095] The disclosed embodiments are described above to enable any person skilled in the art to implement or use the present invention. Various modifications of these embodiments are obvious to those skilled in the art, and the general principles defined herein may also be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments given herein, but is consistent with the broadest scope of the principles and novel features disclosed in this application.
[0096] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A model training method for automatic commenting, characterized in that: include: Selecting samples that meet the first preset number requirement as a sample set, and determining the comment attribute of each sample, wherein each sample at least includes user-posted content and comment content for the user-posted content, and the comment attribute is used to characterize the attribute characteristics of the comment content in the sample that conform to the set classification rule; Using the sample set to perform iterative model training on the large language model until a preset convergence condition is reached to obtain an applicable large language model; The specific steps of each model iteration training of the large language model include: Determine the training input text of the large language model based on the user-published content in the sample, use the comment attribute of the sample as an output limiting condition, and obtain the automatic comment prediction content output by the large language model that meets the output limiting condition; The comment content in the sample is used as a label, a loss function value is determined according to the automatic comment prediction content and the label, and the model parameters of the large language model are adjusted according to the loss function value, wherein the loss function value is used to characterize the difference between the automatic comment prediction content and the label.
2. The model training method for automatic commenting according to claim 1, characterized in that: The types of samples in the sample set include: single-level interaction samples, and multi-level interaction samples composed of multi-level interaction contents, wherein the first-level interaction contents of the multi-level interaction samples include the initial user-posted content, and the comment contents for the initial user-posted content, and the other levels of interaction contents of the multi-level interaction samples include the reply contents posted by the user for the comment contents of the previous level, and the comment contents for the reply contents of the current level; the single-level interaction contents of the single-level interaction samples include the user-posted content, and the comment contents for the user-posted content; In each model iteration training process, when the current input sample is a multi-level interactive sample, the model training is performed layer by layer on the current input sample.
3. The model training method for automatic commenting as claimed in claim 2, characterized in that: The step of performing model training on the currently input sample layer by layer specifically includes: For the currently input sample, model training is started from the first level, and after the model training of each level is completed, the model training of the next level is started until the model training of the last level is completed; wherein, in the model training process of the first level, the user-published content in the first level interactive content is used as the training input text, and the comment content in the first level interactive content is used as the label, and in the model training of other levels, the user's reply content to the comment content of the previous level and the interactive content of each level before the current level are used as the training input text, and the comment content to the reply content of the current level is used as the label.
4. The model training method for automatic commenting as claimed in claim 2, characterized in that: The comment attributes include at least one of the following attributes: Style attributes, used to characterize the image characteristics set for the simulated reviewer; Sentiment attribute, which is used to characterize the simulated reviewer's attitude toward the content posted by the user being reviewed; Type attribute, used to indicate the set type to which the comment content belongs; The stance attribute is used to characterize whether the simulated commentator supports the content posted by the user being commented on; The identity attribute is used to characterize the relationship between the simulated commentator and the user who posted the content to be commented on.
5. An automatic comment method, characterized in that: include: Acquire user-posted content to be commented on, and determine the comment attributes to be automatically generated for the user-posted content; Determine the input text of the applicable large language model based on the user-published content to be commented on, use the comment attribute to be automatically generated as an output limiting condition, and obtain the automatic comment that meets the output limiting condition output by the applicable large language model; the applicable large language model is trained using the model training method described in any one of claims 1 to 4; Post the generated automated reviews as a simulated reviewer.
6. The automatic review method according to claim 5, characterized in that: The method further comprises: Before the applicable large language model outputs the automatic comment that meets the output limiting condition, the input text is judged to have comment value by using a pre-trained first filtering model; wherein the first filtering model is used to judge whether the input text to which the applicable large language model is applicable has comment value; And / or, before the generated automatic comment is published as a simulated commentator, a pre-trained second filtering model is used to determine whether the generated automatic comment is a friendly comment, and a pre-trained third filtering model is used to determine whether the content relevance between the generated automatic comment and the user-posted content to be commented on meets the requirements; wherein the second filtering model is used to determine whether the automatic comment is a friendly comment, and the third filtering model is used to determine whether the content relevance between the automatic comment and the user-posted content to be commented on meets the requirements.
7. The automatic review method according to claim 5, characterized in that: The user-posted content to be commented on includes: initial user-posted content, or reply content posted by the user to any automatic comment; Determining input text to which a large language model can be applied based on the user-published content to be commented on includes: In the case where the user-posted content to be commented on is the initial user-posted content, using the initial user-posted content as the input text of the first round of the applicable large language model; After the generated automatic comments are published, when a reply content posted by a user to the automatic comments is received, the input text of the previous round, the automatic comments generated in the previous round, and the reply content are concatenated as the input text of a new round to which the large language model can be applied.
8. A model training system for automatic commenting, characterized in that: include: A sample selection module, used to select samples that meet a first preset number requirement as a sample set, and determine the comment attribute of each sample, wherein each sample at least includes user-posted content and comment content for the user-posted content, and the comment attribute is used to characterize the attribute characteristics of the comment content in the sample that conform to the set classification rules; A model training module, used to perform iterative model training on the large language model using the sample set until a preset convergence condition is reached to obtain an applicable large language model; Among them, the model training module is specifically used to: determine the training input text of the large language model based on the user-published content in the sample, use the comment attributes of the sample as output limitation conditions, and obtain the automatic comment prediction content output by the large language model that meets the output limitation conditions; use the comment content in the sample as a label, determine the loss function value according to the automatic comment prediction content and the label, and adjust the model parameters of the large language model according to the loss function value, wherein the loss function value is used to characterize the difference between the automatic comment prediction content and the label.
9. An automatic comment system, characterized in that: include: An automatic comment generation module, used to obtain user-published content to be commented on, and determine the attributes of the comment to be automatically generated for the user-published content; Determine the input text of the applicable large language model based on the user-published content to be commented on, use the comment attribute to be automatically generated as an output limiting condition, and obtain the automatic comment that meets the output limiting condition output by the applicable large language model; the applicable large language model is trained using the model training method described in any one of claims 1 to 4; The publishing module is used to publish the generated automatic comments as a simulated commentator.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, it implements the model training method as described in any one of claims 1-4, and / or implements the automatic comment method as described in any one of claims 5-7.
11. A computer device, characterized in that: It includes: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the model training method as described in any one of claims 1 to 4, and / or implement the automatic comment method as described in any one of claims 5 to 7.
Citation Information
Cited By
Data generation method and device, storage medium and computing equipment
CN119250041A
