Model training method and device, electronic equipment and storage medium

By acquiring a dataset of text and comment information and iteratively training a multilingual model and a reward model, the limitations and incoherence of extractive summarization models are addressed, thereby improving the accuracy and quality of summarization.

CN116821324BActive Publication Date: 2025-11-04VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310498933.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-05
Publication Date
2025-11-04
Estimated Expiration
2043-05-05

AI Technical Summary

Technical Problem

Existing extractive summarization models may result in one-sided and incoherent content during sentence extraction and sorting, leading to poor summarization accuracy.

Method used

By acquiring a dataset containing text and comment information, iteratively training multiple language models and reward models, and combining comment information and human scoring, the parameters of the second language model are optimized to generate high-quality summaries.

Benefits of technology

It improves the accuracy and coherence of the abstracts, resulting in abstracts that better meet user needs and are of higher quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116821324B_ABST
    Figure CN116821324B_ABST
Patent Text Reader

Abstract

The application discloses a model training method and device, electronic equipment and storage medium, and belongs to the technical field of artificial intelligence. The method comprises the following steps: acquiring a data set, wherein the data set comprises texts and comment information corresponding to each text; inputting the data set into a first language model and a second language model to obtain a first summary result and a second summary result respectively, and inputting the text into the second language model to obtain a third summary result; inputting the first summary result, the second summary result and the third summary result into a reward model to obtain first scoring information of the first summary result, second scoring information of the second summary result and third scoring information of the third summary result; and iteratively updating parameters in the second language model according to the first scoring information, the second scoring information and the third scoring information until convergence is achieved, so as to obtain a target model, wherein the target model is used for extracting summary content from the text.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of artificial intelligence, and particularly relates to a model training method and device, an electronic device, and a storage medium. BACKGROUND

[0002] In the prior art, a user can input an article into an extractive summarization model to trigger an electronic device to detect the article input by the user through the extractive summarization model and extract a plurality of sentences in units of sentences, so as to directly sort and reorganize the plurality of sentences to form a summary corresponding to the article.

[0003] However, in the above method, the extractive summarization model extracts a plurality of sentences in units of sentences to form an article summary, which may result in the situation that the extracted content is one-sided due to the large unit of extraction; and the extractive summarization model may result in the situation that the sentences of the sorted and reorganized summary are not smooth and the main content is not clear due to the difference in the article region corresponding to the extracted sentences. Thus, the accuracy of the electronic device in extracting a summary from an article is poor. SUMMARY

[0004] The embodiments of the present application aim to provide a model training method and device, an electronic device, and a storage medium, which can improve the accuracy of the electronic device in extracting summary information.

[0005] In a first aspect, the embodiments of the present application provide a model training method, which comprises: obtaining a data set, the data set comprising texts and comment information corresponding to each text; the comment information being comment information with a number of likes greater than a threshold; inputting the data set into a first language model and a second language model to obtain a first summary result and a second summary result, respectively, and inputting the text into the second language model to obtain a third summary result; each summary result comprising summary content of the text; inputting the first summary result, the second summary result, and the third summary result into a reward model to obtain first scoring information of the first summary result, second scoring information of the second summary result, and third scoring information of the third summary result; and iteratively updating parameters in the second language model according to the first scoring information, the second scoring information, and the third scoring information until convergence is achieved, to obtain a target model, the target model being used to extract summary content from a text.

[0006] In a second aspect, an embodiment of the present application provides a model training apparatus, the model training apparatus comprising: an obtaining module, an executing module and an updating module. The obtaining module is configured to obtain a data set, the data set comprising texts and comment information corresponding to each text; the comment information being comment information with a number of likes greater than a threshold. The executing module is configured to input the data set obtained by the obtaining module into a first speech model and a second language model to obtain a first summary result and a second summary result respectively, and input the text into the second language model to obtain a third summary result; each summary result comprising a summary content of the text; and input the first summary result, the second summary result and the third summary result into a reward model to obtain first scoring information of the first summary result, second scoring information of the second summary result and third scoring information of the third summary result. The updating module is configured to iteratively update parameters in the second language model according to the first scoring information, the second scoring information and the third scoring information obtained by the executing module until convergence, to obtain a target model, the target model being used to extract a summary content from a text.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising a processor and a memory, the memory storing programs or instructions executable on the processor, the programs or instructions being executed by the processor to implement the steps of the method according to the first aspect.

[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, the readable storage medium storing programs or instructions, the programs or instructions being executed by a processor to implement the steps of the method according to the first aspect.

[0009] In a fifth aspect, an embodiment of the present application provides a chip, the chip comprising a processor and a communication interface, the communication interface being coupled to the processor, the processor being configured to run programs or instructions to implement the method according to the first aspect.

[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, the program product being stored in a storage medium, the program product being executed by at least one processor to implement the method according to the first aspect.

[0011] In the embodiment of the present application, the model training device obtains a data set including text and comment information corresponding to each text, and obtains a first summary result, a second summary result by inputting the data set into the first language model and the second language model, and a third summary result by inputting the text in the data set into the second language model. Then, the model training device inputs the first summary result, the second summary result and the third summary result into the reward model to obtain scoring information corresponding to each summary result, so as to update the parameters in the second language model through the scoring information until convergence, and obtain a target model that can extract summary content from text. In the present scheme, since the model training device inputs the information included in the data set into the first language model and the second language model respectively to obtain a plurality of different summary results, the use of comment information corresponding to each text increases the reference information for the model training device to obtain a summary, and improves the accuracy of the model training device to obtain a summary. Moreover, the model training device can adjust the parameters in the second language model according to the high and low of the scoring information corresponding to the plurality of summary results to perform iterative updating, and further improve the accuracy of the model training device to extract an article summary, so as to obtain a target model that can provide high-quality summary content, and improve the quality of the article summary obtained by the model training device. BRIEF DESCRIPTION OF DRAWINGS

[0012] Figure 1 is one of the flowcharts of the model training method provided by the embodiment of the present application;

[0013] Figure 2 is the second flowchart of the model training method provided by the embodiment of the present application;

[0014] Figure 3 is the third flowchart of the model training method provided by the embodiment of the present application;

[0015] Figure 4 is the structural diagram of the extractive summary model provided by the embodiment of the present application;

[0016] Figure 5 is the fourth flowchart of the model training method provided by the embodiment of the present application;

[0017] Figure 6 is the schematic diagram of the iterative learning process provided by the embodiment of the present application;

[0018] Figure 7 is the fifth flowchart of the model training method provided by the embodiment of the present application;

[0019] Figure 8 is the structural diagram of the comment-guided large model provided by the embodiment of the present application;

[0020] Figure 9 is a flowchart of a model training method provided by an embodiment of the present application;

[0021] Figure 10 is a flowchart of a model training method provided by an embodiment of the present application;

[0022] Figure 11 is a flowchart of a model training method provided by an embodiment of the present application;

[0023] Figure 12 is a flowchart of a model training method provided by an embodiment of the present application;

[0024] Figure 13 is a structural diagram of a model training method provided by an embodiment of the present application;

[0025] Figure 14 is a flowchart of a model training method provided by an embodiment of the present application;

[0026] Figure 15 is a structural diagram of a model training device provided by an embodiment of the present application;

[0027] Figure 16 is a hardware structural diagram of an electronic device provided by an embodiment of the present application;

[0028] Figure 17 is a hardware structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0029] The technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.

[0030] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than that illustrated or described herein, and the objects distinguished by "first", "second", and the like are generally of a kind and are not limited in number, for example, the first object can be one or more. In addition, "and / or" in the specification and claims indicates at least one of the connected objects, and the character " / ", generally indicates that the objects before and after are in an "or" relationship.

[0031] The model training method provided by the embodiments of the present application will be described in detail below with reference to specific examples and application scenarios in combination with the accompanying drawings.

[0032] The embodiments of the present application are applied to the scenario of obtaining an abstract text from an article. That is, the model training apparatus iteratively updates the model through a large number of articles to obtain a target model, so that the user can quickly obtain the article abstract through the target model.

[0033] It should be noted that the embodiments of the present application are essentially a model trained to obtain a model that can perform a text generation task, which can not only be used for text abstracts of various scenarios and various types of texts, but also be applied to text rewriting, creative copywriting, writing, writing copywriting and other various text generation tasks, and has universality.

[0034] Among them, the article abstract and the text abstract refer to: the model training apparatus extracts the key information sentence of the article or refines the core content through the input article or text.

[0035] The execution subject of the model training method provided by the embodiments of the present application is the model training apparatus, which can be an independent apparatus, or an electronic device, or a functional module or entity in an electronic device, and the embodiments of the present application do not limit this. The model training method provided by the embodiments of the present application will be exemplarily described below taking the model training apparatus as an example.

[0036] The embodiments of the present application provide a model training method, Figure 1 A flowchart of the model training method provided by the embodiments of the present application is shown. As shown in Figure 1 The model training method provided by the embodiments of the present application can include the following steps 201 to 204.

[0037] Step 201, the model training apparatus obtains a data set.

[0038] In the embodiments of the present application, the data set includes text and comment information corresponding to each text, and the comment information is comment information with a number of likes greater than a threshold.

[0039] Optionally, in the embodiments of the present application, the text can be text content in a text format or a picture format.

[0040] Optionally, in the embodiments of the present application, the comment information includes but is not limited to: score information, comment content, and comment object.

[0041] Optionally, in this embodiment, the threshold can be the top 10 comments with more than 10 likes. The specific threshold can be determined based on factors such as the number of likes on the corresponding comment and user preferences; this application does not impose any limitations on this.

[0042] Step 202: The model training device inputs the dataset into the first language model and the second language model to obtain the first summary result and the second summary result respectively, and inputs the text into the second language model to obtain the third summary result.

[0043] In this embodiment of the application, the first summary result, the second summary result, and the third summary result all include a summary of the text.

[0044] Optionally, in this embodiment of the application, the first language model is an extractive summarization model that can output a summary result through text and the corresponding comment information.

[0045] Optionally, in the embodiments of this application, the aforementioned second language model can be a model such as GPT3, GPT3.5, BLOOM, or GLM. The specific second language model used can be determined based on factors such as training resources, task complexity, and actual task performance in actual applications, and this application does not impose any limitations on it.

[0046] In this embodiment of the application, the model training device inputs the text included in the dataset and the comment information corresponding to each text into a first language model to obtain a first language result; and inputs the text included in the dataset and the comment information corresponding to each text into a second language model to obtain a second summary result; and inputs the text included in the dataset into the second language model to obtain a third summary result.

[0047] Optionally, in the embodiments of this application, combined with Figure 1 ,like Figure 2 As shown, the step 202 above, "the model training device inputs the dataset into the first language model to obtain the first summary result," can be specifically implemented through steps 202a to 202c. It should be noted that in this embodiment, step 202 is specifically implemented through steps 202a to 202d, where step 202d is: the model training device inputs the target dataset into the second language model to obtain the second summary result, and inputs at least one text into the second language model to obtain the third summary result.

[0048] Step 202a: The model training device inputs the text and the comment information corresponding to each text into the first language model, segments each text, and obtains one or more text sentences.

[0049] In the embodiments of the present application, the model training apparatus inputs the texts and the comment information corresponding to each text into the first language model, and performs segmentation of each text at different granularities according to the punctuation contained in each text, for example, performs segmentation of each text at the clause, sentence and whole sentence according to the punctuation, to obtain a sentence set composed of one or more text sentences corresponding to each text, and re-arranges and counts the sentences of different granularities in the sentence set according to the granularity size, so that the model training apparatus can obtain the summary content corresponding to each text according to the sentences of different granularities contained in the sentence set.

[0050] Optionally, in the embodiments of the present application, the model training apparatus can take the punctuation symbols such as “.”, “?”, “!” and “…” as the segmentation granularity of the whole sentence.

[0051] Optionally, in the embodiments of the present application, the model training apparatus can take “;” as the segmentation granularity of the sentence.

[0052] Optionally, in the embodiments of the present application, the model training apparatus can take “,” as the segmentation granularity of the clause.

[0053] Exemplarily, taking the partial sentence "If A, then B; and, if B, then C. When A is known, C can be obtained!" in the article as an example, the model training apparatus divides the partial sentence into two complete sentences, i.e., "If A, then B; and, if B, then C" and "When A is known, C can be obtained!" according to "." and "!", and records the two complete sentences as complete sentence 1 and complete sentence 2 respectively. Then, the model training apparatus can divide complete sentence 1 into two sentences, i.e., "If A, then B" and "and, if B, then C", according to " ; " and records the two sentences as sentence 1 and sentence 2 respectively. Next, the model training apparatus can divide sentence 1 into two clauses, i.e., "If A, then B" into "If A" and "then B", and records as clause 1 and clause 2; divide sentence 2 into three clauses, i.e., "and, if B, then C" into "and", "if B" and "then C", and records as clause 3, clause 4 and clause 5; and divide complete sentence 2 into two clauses, i.e., "When A is known, C can be obtained" into "When A is known" and "C can be obtained". Thus, the model training apparatus obtains the corresponding sentence set according to the partial sentence in the article, and rearranges and counts in the order of complete sentence, sentence and clause, i.e., the model training apparatus obtains the sentence set { "If A, then B; and, if B, then C", "When A is known, C can be obtained", "If A, then B", "and, if B, then C", "If A", "then B", "and", "if B", "then C", "When A is known", "C can be obtained"} according to "If A, then B; and, if B, then C. When A is known, C can be obtained!" and records as (s1, s2, s3, …, s10, s11).

[0054] In step 202b, the model training apparatus scores the text sentences corresponding to each text according to the comment information corresponding to each text to obtain scoring information of each text sentence.

[0055] In the embodiments of the present application, the comment information corresponding to each text includes the comment content of the comment information and the number of likes corresponding to the comment information.

[0056] In the embodiments of the present application, the model training apparatus obtains the scoring information of each sentence in the sentence set by calculating the score according to the comment content and the number of likes of the comment corresponding to each text and the sentences in the sentence set of the respective text.

[0057] For example, suppose the texts are text A and text B, and the sentence set corresponding to text A is (s11, s12, s13), and the comment information corresponding to text A includes comments c11 and c12; the sentence set corresponding to text B is (s21, s22), and the comment information corresponding to text B includes comments c21, c22, and c23. The model training device segments text A, obtaining the text sentences corresponding to text A as s11, s12, and s13, and then scores s11, s12, and s13 respectively using the comment information c11 and c12 corresponding to text A to obtain the score information for s11, s12, and s13. The model training device segments text B, obtaining the text sentences corresponding to text B as s21 and s22, and then scores s21 and s22 respectively using the comment information c21, c22, and c23 corresponding to text B to obtain the score information for s21 and s22.

[0058] Optionally, in the embodiments of this application, combined with Figure 2 ,like Figure 3 As shown, step 202b can be implemented through steps 202b1 to 202b3.

[0059] Step 202b1: The model training device determines the weight value of the comment information corresponding to each text based on the number of likes for each text's comment information.

[0060] Optionally, in the embodiments of this application, the method for determining the above-mentioned weight values ​​includes, but is not limited to, any of the following:

[0061] 1. Directly determine the weight value of the comment information corresponding to each text by the number of likes for each text. For example, if a text corresponds to three comments, namely comment 1, comment 2, and comment 3, and comment 1 has 5 likes, comment 2 has 3 likes, and comment 3 has 2 likes, then the model training device can set the weight value corresponding to comment 1 to 5, the weight value corresponding to comment 2 to 3, and the weight value corresponding to comment 3 to 2.

[0062] 2. Based on the number of likes for each text's corresponding comment information, assign weight values ​​to the comment information corresponding to each text in a proportional manner. For example, if a text corresponds to three comments, namely comment 1, comment 2, and comment 3, and comment 1 has 50 likes, comment 2 has 30 likes, and comment 3 has 20 likes, then the model training device can set the weight value corresponding to comment 1 to 0.5, the weight value corresponding to comment 2 to 0.3, and the weight value corresponding to comment 3 to 0.2.

[0063] 3. Determine the weight value of the comment information corresponding to each text according to the like number range corresponding to the like number of each text corresponding comment information, such as the model training device can set the weight value of the comment information with like number 0-14 to 1, set the weight value of the comment information with like number 15-29 to 2, set the weight value of the comment information with like number 30-44 to 3, set the weight value of the comment information with like number 45-59 to 4.

[0064] Step 202b2, the model training device calculates the similarity of the comment information corresponding to each text and the text sentence corresponding to the text.

[0065] In the embodiment of the application, the model training device obtains the representation information vector of the comment content corresponding to each text, and the representation information vector corresponding to each sentence in the sentence set corresponding to each text, to calculate the similarity.

[0066] Optionally, in the embodiment of the application, the model training device can obtain the above-mentioned representation information vector through a pre-training model such as BERT.

[0067] Optionally, in the embodiment of the application, the model training device can calculate the above-mentioned similarity through cosine similarity or Euclidean distance of vectors and the like.

[0068] Optionally, in the embodiment of the application, the above-mentioned similarity can be content similarity or semantic similarity. The content similarity can be to judge whether the same keyword is contained in the text content.

[0069] Exemplarily, if the model training device calculates the content similarity, the model training device performs sentence analysis on the comment information corresponding to each text and the text sentence of the respective text to obtain the contained text information, and then retrieves whether the text information has the same keyword to obtain the content similarity.

[0070] Exemplarily, if the model training device calculates the semantic similarity, the model training device performs semantic analysis on the comment information corresponding to each text and the text sentence of the respective text, and then obtains the semantic similarity through the semantic analysis result.

[0071] Step 202b3, the model training device determines the scoring information of each text sentence according to the similarity, the weight value and the position information of each text sentence in the text.

[0072] In the embodiment of the application, the model training device can first calculate the comment score information of each text sentence according to the similarity and the weight value, and then calculate the scoring information of each text sentence according to the comment score information and the position information of each text sentence in the text.

[0073] Optionally, in the embodiment of the present application, the model training apparatus can determine the comment score information of each text sentence according to the similarity and the weight value by using Formula One.

[0074]

[0075] wherein s i is the i-th sentence in the sentence set corresponding to a text, c j is the j-th comment corresponding to a text, similarity(s i , c j ) is the similarity between the i-th sentence and the j-th comment corresponding to a text, w j is the weight value corresponding to the j-th comment corresponding to a text; i and j are both positive integers.

[0076] Optionally, in the embodiment of the present application, the model training apparatus can divide each text into three regions, i.e., the first segment, the last segment and the middle segment, and set different weight values according to the position of each text in at least one text, i.e., the model training apparatus sets the weight value corresponding to the sentence located in the first segment as W1, the model training apparatus sets the weight value corresponding to the sentence located in the last segment as W2, and the model training apparatus sets the weight value corresponding to the sentence located in the middle segment as W3. Then, the model training apparatus can select the corresponding weight value from W1, W2 and W3 according to the position of each text, and calculate the product of the weight value and the comment score information score(s i ) as the scoring information of the text sentence. For example, W1 is 0.4, W2 is 0.4, and W3 is 0.3.

[0077] It should be noted that since the number of summary sentences contained in the first segment and the last segment of the text is greater than the number of summary sentences contained in the middle segment of the text, when the model training apparatus determines the corresponding position information according to the position information of each text sentence in the text, the model training apparatus sets a greater weight value for the first segment and the last segment than the weight value set for the middle segment. The specific weight value can be adjusted according to the actual application requirements, which is not limited in the present application.

[0078] For example, W1 is 0.4, W2 is 0.4, and W3 is 0.3. If the third sentence has a corresponding comment score score(s3) calculated by Formula One, and the third sentence is located in the first segment of the article, then the scoring information corresponding to the third sentence is 0.4score(s3). If the twentieth sentence has a corresponding comment score score(s3) calculated by Formula One, and the twentieth sentence is located in the last segment of the article, then the scoring information corresponding to the twentieth sentence is 0.4score(s20 ) If the tenth sentence is calculated by the first formula to correspond to a comment score of score(s3), and the tenth sentence is located in the first paragraph in the article, the scoring information corresponding to the tenth sentence is 0.3score(s 10 ).

[0079] In the embodiment of the present application, the model training apparatus determines the weight value of the comment information corresponding to each text according to the number of likes of the comment information corresponding to each text, thereby improving the accuracy of the model training apparatus in obtaining the summary content by combining the content contained in the text and the comment information corresponding to the text. Moreover, after calculating the similarity between the comment information and the text sentence, the model training apparatus can calculate the comment score information of each text sentence by combining the position information of the text sentence in the article, thereby further improving the accuracy of the model training apparatus in obtaining the summary content by combining the position information of the text sentence in the article on the basis of obtaining the summary content by the text and the comment information corresponding to the text.

[0080] In step 202c, the model training apparatus obtains at least one text sentence from each text as the summary content according to the scoring information of each text sentence, to obtain a first summary result.

[0081] In the embodiment of the present application, the model training apparatus obtains the text sentence with the scoring information in the top five in ranking according to the scoring information of each text sentence, and performs position sorting on the text sentence according to the position information of the text sentence in the original text, thereby obtaining the first summary result.

[0082] Optionally, in the embodiment of the present application, after the model training apparatus obtains at least one text sentence from each text as the summary content, the model training apparatus can detect the summary content to pre-process the summary content, thereby obtaining the first summary result.

[0083] Illustratively, after the model training apparatus obtains at least one text sentence from each text as the summary content, the model training apparatus can detect whether there is text information redundancy in the summary content to adaptively delete the text content with information redundancy in the summary content, thereby obtaining the first summary result.

[0084] Optionally, in the embodiment of the present application, after the model training apparatus obtains at least one text sentence from each text as the summary content, the model training apparatus can obtain an integer, a sentence or a clause with a suitable length from the multiple text sentences in the preset ranking range according to the length requirement of the required summary result, to combine to obtain the first summary result.

[0085] Illustratively, as Figure 4As shown, the model training device inputs a text containing a beginning paragraph, a middle paragraph, and a closing paragraph into the first language model. The first language model performs sentence segmentation on this text to obtain n clauses, namely s1, s2, ..., sn. n Then, the model training device can construct the correspondence between n clauses and m users' comment information through the sentence scoring model, calculate the relevance, and combine the position information of each clause in the text to perform weighted calculation to obtain the score corresponding to each clause. Thus, the model training device obtains the summary result corresponding to the text by arranging the scored clauses.

[0086] In this embodiment, the model training device segments the text at different granularities to obtain one or more text sentences corresponding to each text. It then obtains the scoring information for each text sentence using the comment information corresponding to each text, and based on the scoring information, obtains the summary content corresponding to each text. Thus, by using multi-dimensional sentence segmentation, the model training device more accurately obtains the scoring information for sentences of various lengths, thereby improving the accuracy and coherence of the summary results obtained by the model training device, and ultimately enhancing the quality of the summary results obtained.

[0087] Step 203: The model training device inputs the first summary result, the second summary result, and the third summary result into the reward model to obtain the first scoring information of the first summary result, the second scoring information of the second summary result, and the third scoring information of the third summary result.

[0088] In this embodiment of the application, the reward model described above is a model that can score input data, such as summary results.

[0089] Optionally, in the embodiments of this application, combined with Figure 1 ,like Figure 5 As shown, after step 202 above, the model training method provided in this application embodiment further includes steps 501 to 503.

[0090] Step 501: The model training device acquires the human scoring information of the first summary result, the human scoring information of the second summary result, and the human scoring information of the third summary result.

[0091] In this embodiment, the model training device obtains human scoring information to correct the summary results obtained by the model training device through human participation, thereby making the summary results obtained by the model training device more in line with user needs.

[0092] Optionally, in this embodiment of the application, the above-mentioned manual scoring information is a score based on the accuracy, authenticity and harmlessness of the summary results, in order to measure the quality of the summary results.

[0093] It should be noted that the accuracy mentioned above measures whether the summary can accurately summarize the content of the original text, and whether the content is accurate, concise, and clearly expressed.

[0094] The aforementioned authenticity measures whether the summary results generated by the model training device conform to the facts and cannot generate erroneous summary content that violates objective facts.

[0095] The aforementioned harmlessness measures the absence of grammatical errors, discriminatory or misleading statements in the summaries generated by the model training device.

[0096] Step 502: The model training device calculates the third loss function based on the human scoring information of the first summary result, the human scoring information of the second summary result, and the human scoring information of the third summary result.

[0097] In this embodiment, the model training device obtains the human scoring information of the summary results corresponding to different texts by users, calculates the third loss function, and trains the model to obtain a model that can automatically score the summary results.

[0098] Optionally, in the embodiments of this application, the model training device may use Formula 2 to calculate the third loss function.

[0099]

[0100] Where x represents the text in the dataset, y ω The abstract result corresponding to the highest score among the human-scored scores of the first, second, and third abstract results is y. l The abstract result corresponding to the lowest score among the human scores for the first, second, and third abstract results is r. θ (x,y ω ) represents y ω The score of the highest score among the human-rating information of the first summary result, the second summary result, and the third summary result, r. θ (x,y l ) represents y l The score of the lowest score among the human scores of the first summary result, the second summary result, and the third summary result is σ, which is a negative constant.

[0101] Step 503: The model training device uses the backpropagation algorithm to iteratively update the parameters in the sub-language model according to the third loss function until convergence, thus obtaining the reward model.

[0102] In this embodiment of the application, the model training device trains the sub-language model according to the third loss function to obtain a reward model, that is, to obtain a model that can automatically score the input answer.

[0103] Optionally, in the embodiments of this application, the reward model described above can be a BERT-like model or any large-scale language model.

[0104] It should be noted that steps 501 to 503 above can be performed after step 202 and before step 203.

[0105] In this embodiment, the model training device combines human scoring information with user scores of the model summary results obtained by the model training device, enabling the model training device to improve in the direction of user needs, thereby improving the accuracy of the summary results obtained by the model training device. Furthermore, based on human scoring information, the model training device trains a reward model that can automatically score based on the results, thereby simplifying the steps of obtaining scoring information during the model training device update process and improving the iteration update rate of the model training device.

[0106] Step 204: The model training device iteratively updates the parameters in the second language model according to the first scoring information, the second scoring information and the third scoring information until convergence, and obtains the target model.

[0107] In this embodiment of the application, the target model described above is used to extract summary content from text.

[0108] In this embodiment, the model training device iterates the parameters during the training process of the second language model, using the first scoring information, the second scoring information, and the third scoring information as reward and punishment information, and then adjusts the parameters in the second language model through backpropagation of the loss function.

[0109] It should be noted that the specific calculation method for the above loss function can be found in Formula 2. Here, x represents the text in the dataset, and y... ω The summary result corresponding to the highest score among the first score of the first summary result, the second score of the second summary result, and the third score of the third summary result is y. l The summary result corresponding to the lowest score among the first score of the first summary result, the second score of the second summary result, and the third score of the third summary result is r. θ (x,y ω ) represents y ω The score of the highest-scoring information among the first scoring information of the first summary result, the second scoring information of the second summary result, and the third scoring information of the third summary result, rθ (x,y l ) represents y l The score of the scoring information with the lowest score in the first scoring information of the first summary result, the second scoring information of the second summary result, and the third scoring information of the third summary result, and σ is a negative constant. Then, the model training apparatus calculates the loss function result by Formula Two, so as to realize the iterative updating of the parameters in the second language model by the loss function back propagation until convergence, and obtain the target model.

[0110] Optionally, in the embodiments of the present application, the model training apparatus can repeatedly perform the above steps 202 to 204 to train the reward model according to the artificial scoring information corresponding to the summary results, and give the scoring of the summary results generated at different steps in the iterative training process of the second language model according to the reward model, and use the scoring as the reward and punishment information to guide the iterative updating of the parameters until convergence, so as to obtain the target model.

[0111] Optionally, in the embodiments of the present application, in the initial stage of the iterative updating of the parameters in the second language model by the model training apparatus, the second language model may not be able to quickly generate high-quality summary results, but the first language model can quickly generate high-quality summary results. Therefore, in the initial stage of the iterative updating, the model training apparatus can refer to the summary results of the first language model to score and sort the summary results of the second language model, so as to provide a positive influence on the updating of the second language model and speed up the optimization process of the second language model.

[0112] Optionally, in the embodiments of the present application, after the second language model has been iteratively updated for several times, the model training apparatus can only retain the summary results with scores greater than a threshold in the multiple iterations, so as to reduce the influence of the summary results with low scores on the iterative optimization of the model.

[0113] It should be noted that the above iterative updating until convergence can be understood as: in the process of the iterative updating of the parameters in the second language model by the model training apparatus according to the first scoring information, the second scoring information and the third scoring information, the change of the at least one updated weight value is small in succession, i.e. the difference between the at least one weight value obtained in succession is less than a threshold; or in the process of the iterative updating of the parameters in the second language model by the model training apparatus according to the first scoring information, the second scoring information and the third scoring information, the summary results output by the model training apparatus meet the actual needs of the user.

[0114] Exemplarily, as Figure 6As shown, the model training apparatus inputs one text into the first language model, obtains A1 (i.e., the first summary result) through the extractive summary model (i.e., the first language model), obtains A3 (i.e., the third summary result) through the large model (i.e., the second language model), and obtains A2 (i.e., the second summary result) by inputting the one text and the comment corresponding to the text into the large model. Then, the model training apparatus can perform artificial sorting annotation according to A1, A2 and A3 to measure the quality of the three summary results, and obtain the scores of A1, A2 and A3 as the reward / punishment information through the reward model, so as to use the difference value of the scores, i.e., the size of the reward / punishment, as a signal for adjusting the parameters of the model training apparatus, so as to affect the loss function through the signal to give optimization guidance to the second language model, provide an optimization direction, and perform iterative updating until convergence to obtain the target model.

[0115] The model training method provided in the embodiments of the present application includes the following steps.

[0116] Optionally, in an embodiment of the present application, the second language model includes a sub-language model and an updated encoder model. Figure 1 As shown in FIG. 2, the model training method provided in the embodiments of the present application includes the following steps. Figure 7 As shown in FIG. 2, the model training method provided in the embodiments of the present application includes the following steps.

[0117] Step 301: The model training device inputs the comment information corresponding to each text into the encoder model for encoding, and obtains the encoded comment data.

[0118] Optionally, in this embodiment of the application, the encoder model is used to influence the summary results produced by the model training device. That is, the encoded comment data output by the encoder model can be used as prompt words to trigger the model training device to output summary results that tend to be prompt words.

[0119] Step 302: The model training device inputs the text and the encoded comment data into the sub-language model to obtain the predicted summary results for each text.

[0120] In this embodiment of the application, the model training device takes the text and the encoded comment data output by the encoder model as input data and inputs them into the sub-language model so that the sub-language model outputs the predicted summary result corresponding to each text.

[0121] Step 303: The model training device calculates the first loss function based on the predicted summary result and the corresponding reference summary result of each text.

[0122] Step 304: The model training device uses the backpropagation algorithm based on the first loss function to iteratively update the parameters in the encoder model until convergence, thus obtaining the second language model.

[0123] Optionally, in this embodiment of the application, the model training device may fix the parameter layer of the sub-language model to update the parameters of the encoder model with gradient.

[0124] It should be noted that the above iterative update until convergence can be understood as follows: during the iterative update process of the model training device using the backpropagation algorithm, if the change of at least one consecutive updated weight value is small, that is, the difference between at least one consecutive weight value is less than a threshold, then the parameters in the encoder model can be said to have converged through iterative updates.

[0125] For example, such as Figure 8 As shown, the model training device inputs the highly-rated comment information corresponding to each text into the encoder model in the form of a vector to obtain the encoded comment data. The output of the encoder model is then used as the input to a larger model to calculate the loss function by combining the predicted summary output of the larger model with the standard answers (i.e., reference summary results) contained in the dataset. This allows for backpropagation and iterative updating of the model parameters to obtain model G, i.e., the second language model.

[0126] It should be noted that steps 301 to 304 above can be performed after step 201 and before step 202.

[0127] In this embodiment, the model training device trains a sub-language model based on the text and comment data output by the encoder model. This allows the encoder model to influence the predicted summary results obtained by the model training device. Furthermore, the model training device can calculate a loss function between the predicted and reference summary results, and then iteratively update it through backpropagation to obtain a second language model. Thus, by learning the feature information of the comments, the encoder model intervenes in the sub-language model, enabling the model training device to obtain a second language model. This improves the accuracy and quality of the summary information obtained by the model training device.

[0128] Optionally, in another embodiment of this application, the second language model described above includes a sub-language model with updated parameters. Combined with... Figure 1 ,like Figure 9 As shown, before "the model training device inputs the text into the second language model to obtain the third summary result" in step 202 above, the model training method provided in this application embodiment further includes steps 401 to 405.

[0129] Step 401: The model training device divides the dataset into a training set and a test set.

[0130] In this embodiment, the training set is used to train the model in the model training device based on a large amount of data. The test set is used to test the trained device based on a large amount of data to fine-tune the model.

[0131] Step 402: The model training device updates the parameters in the sub-language model based on the training set to obtain the third language model.

[0132] In this embodiment of the application, the model training device trains the sub-language model according to the training set to update the parameters in the sub-language model, so that the sub-language model can output the summary content corresponding to a text according to a text. In this way, the model training device obtains a third language model.

[0133] Step 403: The model training device inputs the test set into the third language model to obtain the predicted summary result of at least one text.

[0134] In this embodiment of the application, after the model training device acquires the third language model, at least one text included in the test set is input into the third language model so that the third language model outputs a predicted summary result of at least one text.

[0135] Step 404: The model training device calculates the second loss function based on the predicted summary result and the corresponding reference summary result of each text.

[0136] In the embodiment of the present application, after the model training apparatus outputs the predicted summary result of at least one text in the test set, the model training apparatus calculates a second loss function according to the predicted summary result corresponding to each text in the test set and the reference summary result, so as to fine-tune the third language model through the second loss function.

[0137] Optionally, in the embodiment of the present application, the model training apparatus calculates the similarity between the predicted summary result of each text and the corresponding reference summary result according to the predicted summary result of each text and the corresponding reference summary result, so as to obtain the second loss function according to the similarity.

[0138] For example, 80% of the data set is taken as the training set and 20% of the data set is taken as the test set. The model training apparatus trains the sub-language model according to the training set, so as to update the parameters in the sub-language model through a large amount of data and obtain the third language model. The third language model can directly output the summary content corresponding to the text input by the user. Then, the model training apparatus obtains the predicted summary result corresponding to at least one text in the test set. Thus, the model training apparatus can calculate the second loss function according to the predicted summary result corresponding to the at least one text and the reference summary result corresponding to the at least one text in the test set.

[0139] In step 405, the model training apparatus iteratively updates the parameters in the third language model until convergence through the back propagation algorithm according to the second loss function, so as to obtain the second language model.

[0140] It should be noted that the above iterative update until convergence can be understood as follows: during the iterative update of the model training apparatus through the back propagation algorithm, the change of the weight value after each update is small, that is, the difference between the at least one weight value obtained continuously is less than a threshold value. Then, it can be considered that the parameters in the third language model have been iteratively updated and converged, or the update is stopped until the number of iterations reaches the maximum number of updates, so as to obtain the second language model.

[0141] It should be noted that the above steps 401 to 405 can be executed after step 201 and before step 202.

[0142] In the embodiment of the present application, the model training apparatus updates the parameters in the sub-language model to obtain the third language model according to the training set, so as to enable the third language model to output the summary result through a large amount of data. The model training apparatus enables the third language model to output the predicted summary result through the test set, and calculates the loss function in combination with the reference summary result, so as to iteratively update the parameters in the third language model through the back propagation algorithm until convergence. In this way, the accuracy of the model training apparatus in obtaining the summary content is improved through the iterative update of the model.

[0143] Optionally, in the embodiments of the present application, in combination with Figure 1 As shown in the above step 204, the message reference method provided by the embodiments of the present application further comprises steps 205 to 207. Figure 10

[0144] In step 205, the model training apparatus inputs the first text and the comment information corresponding to the first text into a target model to obtain target summary content of the first text.

[0145] In the embodiments of the present application, after the first text and the comment information corresponding to the first text are input into the target model, the target model can segment the first text to obtain a sentence set corresponding to the first text, and score the sentence set according to the comment information corresponding to the first text to obtain scoring information of each text sentence in the sentence set, so as to select a sentence with scoring information in a preset ranking range as the target summary content.

[0146] For example, the first text is text C, and the text C includes 5 complete sentences and 5 corresponding comments. The model training apparatus segments the text C to obtain 5 complete sentences, p partial sentences and q sub-sentences, thereby obtaining a sentence set (s31, ……s35, s41, ……s4p, s51, ……s5q) corresponding to the text C, and scores 5+p+q text sentences in the sentence set according to the 5 comments corresponding to the text C to obtain scoring information corresponding to each text sentence, and arranges the text sentences in descending order of the scoring information, and then selects the first 5 text sentences, for example, s31, s43, s44, s54 and s5q, and arranges them in the original order as the target summary content corresponding to the text C.

[0147] It should be noted that the specific schemes for text segmentation, scoring and selection are the same as those of at least one text in the above embodiments, and the related descriptions in the above embodiments can be referred to, and will not be repeated here.

[0148] In step 206, the model training apparatus obtains a target file matched with the target summary content.

[0149] Optionally, in the embodiments of the present application, the target file includes but is not limited to an image file matched with the target summary content, an audio file corresponding to the target summary content, and a subtitle file corresponding to the target summary content.

[0150] ​It should be noted that the model training apparatus can obtain a target file matched with the target summary content according to a script style and a script subject corresponding to the target summary content.

[0151] Optionally, in the embodiment of the present application, when the target file is an audio file corresponding to the target summary content, the model training apparatus can obtain a dubbing file corresponding to the target summary content according to the target summary content; or the model training apparatus can obtain a background music file corresponding to the target summary content according to the target summary content.

[0152] Optionally, in the embodiment of the present application, when the target file is a subtitle file corresponding to the target summary content, the model training apparatus can automatically generate the subtitle file according to the text content corresponding to the target summary content.

[0153] Optionally, in an embodiment of the present application, the target file is an image file. In combination with Figure 10 As shown in Figure 11 The step 206 can be implemented by the following steps 206a to 206c.

[0154] In step 206a, the model training apparatus inputs the target summary content into the image vector representation model to obtain a target vector.

[0155] Optionally, in the embodiment of the present application, the model training apparatus can input the target summary content into the image vector representation model, and train the text-to-picture vector representation model based on a data set of an image description task (for example, the target data set described above) to obtain the target vector.

[0156] It should be noted that the image description task is a multi-modal task combining computer vision (CV) technology and natural language processing technology. The apparatus can accurately understand the information contained in the picture, extract the picture features (including global features and local region features), and return the description information of the image in the form of text. Thus, the demand of users for quickly and accurately obtaining information is met, that is, the image description task is a high-level form of understanding pictures.

[0157] In step 206b, the model training apparatus calculates a vector distance between the target vector and at least one image vector in the database.

[0158] In the embodiment of the present application, the vector distance is used to represent the relevance between the summary content and the image.

[0159] In the embodiment of the present application, after obtaining the target vector, the model training apparatus can convert at least one image in the database into a vector form through the image vector representation model, and map the target vector and the at least one image vector in the database into the same vector space to calculate the vector distance between the target vector and the at least one image vector.

[0160] Optionally, in the embodiment of the present application, the model training apparatus can use the Euclidean distance or the cosine distance to calculate the vector distance between the target vector and the at least one image vector.

[0161] Step 206c, in the case where the vector distance between the target vector and the target image vector is less than or equal to the first distance, the model training apparatus determines the image corresponding to the target image vector as the target file.

[0162] It should be noted that the vector distance between the target vector and the target image vector being less than or equal to the first distance can be understood as that the image corresponding to the target image vector matches the target abstract content.

[0163] In the embodiment of the present application, the model training apparatus converts the target abstract result and the at least one image in the database into vectors, and determines the relevance between the abstract content and the image through the vector distance, so as to obtain the image matching the target abstract content as the target file. In this way, the convenience and accuracy of the model training apparatus in obtaining the target file are improved.

[0164] Optionally, in another embodiment of the present application, the target file is an image file. In combination with Figure 10 As shown in Figure 12 The step 206 can be implemented through the following steps 206d to 206f.

[0165] Step 206d, the model training apparatus inputs the target abstract content into the image vector representation model to obtain a target vector.

[0166] Optionally, in the embodiment of the present application, the model training apparatus can input the target abstract content into the image vector representation model, and train the text-to-image vector representation model based on the data set of the image description task to obtain the target vector.

[0167] Step 206e, the model training apparatus inputs the target vector into the first encoder model to obtain a target text code, and inputs the target image vector into the second encoder model to obtain a target image code.

[0168] In the embodiment of the present application, the model training apparatus trains the text-to-image vector representation model based on the data set of the image description task, that is, the model training apparatus inputs the target vector into the first encoder model to obtain the target text encoding, and inputs the target image vector into the second encoder model to obtain the target image encoding, and maps the target text encoding and the target image encoding into the same vector space.

[0169] Optionally, in the embodiment of the present application, the model training apparatus can optimize according to the provided data set, so that the distance between the two vectors corresponding to the mapped target text encoding and target image encoding is less than a threshold value, so that the first encoder model and the second encoder model can establish the corresponding mapping relationship between the text and the image, that is, the model training apparatus can map the target summary text to the target image encoding through the target text encoding.

[0170] Step 206f, the model training apparatus adopts an image generation model to generate a target file according to the target text encoding and the target image encoding.

[0171] In the embodiment of the present application, the model training apparatus adopts an image generation model to restore the image encoding to a complete image according to the target text encoding and the target image encoding.

[0172] Optionally, in the embodiment of the present application, the above-mentioned image generation model can be a GAN or a diffusion model.

[0173] Exemplarily, taking the diffusion model as an example, the model training apparatus destroys the training data by continuously adding Gaussian noise to the target image, and then restores the target image by reversing the noise process. At this time, the restored target image is related to the original target image, but the restored target image is a brand new image without copyright.

[0174] Exemplarily, as shown in Figure 13 Taking the target summary content "cat sitting" as an example, the model training apparatus inputs "cat sitting" in the format of a vector into the encoder E1 (i.e. the first encoder model) to obtain the target text encoding, and inputs the image in the format of a vector into the encoder E2 (i.e. the second encoder model) to obtain the target image encoding, and maps into the same vector space Q. Thus, according to the data set optimization, the distance between the two mapped vectors is less than a threshold value, so as to establish the corresponding mapping relationship between the text and the image according to the encoder E1 and the encoder E2, and map "cat sitting" into the image encoding through the text encoding. Then, through the diffusion model D (i.e. the image generation model), a non-copyright image is generated.

[0175] In the embodiment of the present application, the model training device obtains the target text code and the target image code according to the target vector corresponding to the target abstract content, so as to establish the mapping relationship between the text and the image, thereby the model training device can generate a new image without copyright according to the target abstract content and the image with copyright matched with the target abstract content. In this way, the diversity of the target file obtained by the model training device is improved, and the probability of the target file being repeated is reduced.

[0176] Step 207, the model training device processes the target abstract content and the target file to obtain a target video.

[0177] In the embodiment of the present application, the model training device renders the target abstract content and the target file according to the rendering engine to obtain a target video.

[0178] In the embodiment of the present application, after the model training device inputs the first text and the comment information corresponding to the first text into the target model to obtain the target abstract content of the first text, the model training device can obtain the target file matched with the target abstract content and synthesize to obtain a target video, thereby the convenience of generating a video according to the abstract content by the model training device is improved. In this way, in the process of sharing the target video by the user, other users can obtain the abstract content corresponding to the first text more conveniently according to the target video, thereby the convenience and diversity of obtaining information by the user are improved.

[0179] The specific process of the model training method provided by the embodiment of the present application is exemplarily described through specific implementation manners as follows. Figure 14 As shown in the figure, the power consumption temperature compensation method can include the following steps 601 to 608.

[0180] Step 601, the model training device inputs a text and comment information corresponding to the text and having a number of likes greater than a threshold value into a first language model to obtain a first abstract result.

[0181] Step 602, the model training device inputs a text and comment information corresponding to the text and having a number of likes greater than a threshold value into a second language model to obtain a second abstract result.

[0182] Step 603, the model training device inputs a text into the second language model to obtain a third abstract result.

[0183] Step 604, the model training device inputs the first abstract result, the second abstract result and the third abstract result into a reward model to obtain first scoring information of the first abstract result, second scoring information of the second abstract result and third scoring information of the third abstract result.

[0184] In step 605, the model training apparatus iteratively updates parameters in the language model according to the first score result, the second score result, and the third score result until convergence is achieved, to obtain a target model.

[0185] In step 606, the model training apparatus obtains a target summary result corresponding to the one text through the target model.

[0186] In step 607, the model training apparatus obtains a target file matching the target summary content.

[0187] In step 608, the model training apparatus processes the target summary content and the target file to obtain a target video.

[0188] It should be noted that the specific description and beneficial effects of steps 601 to 608 above can be referred to the description in the above embodiments, which will not be repeated here.

[0189] It should be noted that the model training method provided in the embodiments of the present application can be executed by a model training apparatus. In the embodiments of the present application, the model training method executed by the model training apparatus is taken as an example to illustrate the model training apparatus provided in the embodiments of the present application.

[0190] Figure 15 A possible structural schematic diagram of the model training apparatus involved in the embodiments of the present application is shown. As shown in Figure 15 The model training apparatus 70 can include an obtaining module 71, an executing module 72, and an updating module 73.

[0191] The obtaining module 71 is configured to obtain a data set, the data set including texts and comment information corresponding to each text; the comment information being comment information with a number of likes greater than a threshold.

[0192] The executing module 72 is configured to input the data set obtained by the obtaining module 71 into a first speech model and a second language model to obtain a first summary result and a second summary result, respectively, and input the text into the second language model to obtain a third summary result; each summary result including summary content of the text; and input the first summary result, the second summary result, and the third summary result into a reward model to obtain first score information of the first summary result, second score information of the second summary result, and third score information of the third summary result.

[0193] The updating module 73 is configured to iteratively update parameters in the second language model according to the first score information, the second score information, and the third score information obtained by the executing module 72 until convergence is achieved, to obtain a target model, the target model being used to extract summary content from a text.

[0194] The embodiment of the application provides a model training device, since the model training device increases the use of the comment information corresponding to each text in the process of inputting the information included in the data set into the first language model and the second language model respectively to obtain a plurality of different summary results, the reference information obtained by the model training device for the summary is increased, and the accuracy of the model training device for obtaining the summary is improved; and the model training device can adjust the parameters in the second language model according to the high and low of the scoring information corresponding to the plurality of summary results, to perform iterative updating, and further improve the accuracy of the model training device for extracting the article summary, so that the target model that can provide high-quality summary content is obtained, and the quality of the article summary obtained by the model training device is improved.

[0195] In a possible implementation, the execution module 72 is specifically configured to input the text and the comment information corresponding to each text into the first language model, segment each text to obtain more than one text sentence, score the text sentence corresponding to each text according to the comment information corresponding to each text to obtain scoring information of each text sentence, and obtain at least one text sentence from each text as summary content according to the scoring information of each text sentence to obtain a first summary result.

[0196] In a possible implementation, the execution module 72 is specifically configured to determine a weight value of the comment information corresponding to each text according to the number of likes of the comment information corresponding to each text, calculate the similarity between the comment information corresponding to each text and the text sentence corresponding to the text, and determine the scoring information of each text sentence according to the similarity, the weight value and the position information of each text sentence in the text.

[0197] In a possible implementation, the second language model includes a sub-language model and an updated encoder model. The execution module 72 is further configured to input the comment information corresponding to each text into the encoder model for coding to obtain coded comment data before inputting the data set into the second language model to obtain a second summary result, and input the text and the coded comment data into the sub-language model to obtain a predicted summary result of each text. The update module 73 is further configured to calculate a first loss function according to the predicted summary result of each text and the corresponding reference summary result, and perform iterative updating on the parameters in the encoder model based on the first loss function until convergence by using a back propagation algorithm to obtain the second language model.

[0198] In a possible implementation, the second language model comprises the sub-language model after updating the parameters. The execution module 72 is further configured to divide the data set into a training set and a test set before inputting the text into the second language model to obtain the third summary result. The update module 73 is further configured to update the parameters in the sub-language model according to the training set to obtain the third language model. The execution module 72 is further configured to input the test set into the third language model to obtain the predicted summary result of at least one text. The update module 73 is further configured to calculate the second loss function according to the predicted summary result of each text and the corresponding reference summary result, and iteratively update the parameters in the third language model by using the back propagation algorithm until convergence according to the second loss function to obtain the second language model.

[0199] In a possible implementation, the acquisition module 71 is further configured to acquire the artificial scoring information of the first summary result, the artificial scoring information of the second summary result, and the artificial scoring information of the third summary result after inputting the text into the second language model to obtain the third summary result. The update module 73 is further configured to calculate the third loss function according to the artificial scoring information of the first summary result, the artificial scoring information of the second summary result, and the artificial scoring information of the third summary result, and iteratively update the parameters in the sub-language model by using the back propagation algorithm until convergence according to the third loss function to obtain the reward model.

[0200] The model training apparatus in the embodiments of the present application can be an electronic device, or a component in an electronic device, for example, an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than the terminal. For example, the electronic device can be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), and the like, and can also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, and the like, and the embodiments of the present application are not limited in this regard.

[0201] The model training apparatus in the embodiments of the present application can be an apparatus with an operating system. The operating system can be an Android operating system, an ios operating system, or other possible operating systems, which are not limited in the embodiments of the present application.

[0202] The model training apparatus provided in the embodiments of the present application can realize each process realized by the method embodiments, and to avoid repetition, details are not described herein.

[0203] Optionally, as shown in Figure 16 The embodiments of the present application also provide an electronic device 90, which includes a processor 91 and a memory 92, and the memory 92 stores programs or instructions executable on the processor 91. When the programs or instructions are executed by the processor 91, each step of the above model training method embodiments is realized, and the same technical effects are achieved. To avoid repetition, details are not described herein.

[0204] It should be noted that the electronic device in the embodiments of the present application includes the mobile electronic device and the non-mobile electronic device described above.

[0205] Figure 17 To realize the hardware structure of an electronic device in the embodiments of the present application.

[0206] The electronic device 100 includes but is not limited to the following components: a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110, etc.

[0207] Those skilled in the art can understand that the electronic device 100 can also include a power supply (such as a battery) for supplying power to each component. The power supply can be logically connected to the processor 110 through a power management system, so as to realize the functions of power management, such as charging, discharging, and power consumption management, through the power management system. Figure 17 The electronic device structure shown in the above figure does not constitute a limitation on the electronic device. The electronic device can include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements, which are not described herein.

[0208] The processor 110 is configured to obtain a data set, the data set including texts and comment information corresponding to each text; the comment information is comment information with a number of likes greater than a threshold value; input the data set into a first language model and a second language model to obtain a first summary result and a second summary result respectively, and input the text into the second language model to obtain a third summary result; each summary result includes summary content of the text; input the first summary result, the second summary result and the third summary result into a reward model to obtain first scoring information of the first summary result, second scoring information of the second summary result and third scoring information of the third summary result; and iteratively update parameters in the second language model according to the first scoring information, the second scoring information and the third scoring information until convergence to obtain a target model, the target model being used to extract summary content from the text.

[0209] The electronic device provided in the embodiments of the present application increases the use of comment information corresponding to each text in the process of inputting information included in the data set into the first language model and the second language model to obtain multiple different summary results, thereby increasing the reference information for the electronic device to obtain a summary and improving the accuracy of the electronic device to obtain a summary. In addition, the electronic device can adjust the parameters in the second language model according to the level of the scoring information corresponding to the multiple summary results to iteratively update the parameters, thereby further improving the accuracy of the electronic device to extract an article summary, so as to obtain a target model that can provide high-quality summary content and improve the quality of the article summary obtained by the electronic device.

[0210] Optionally, the processor 110 is specifically configured to input the text and the comment information corresponding to each text into the first language model to segment each text to obtain more than one text sentence; score the text sentence corresponding to each text according to the comment information corresponding to each text to obtain scoring information of each text sentence; and obtain at least one text sentence from each text as summary content according to the scoring information of each text sentence to obtain the first summary result.

[0211] Optionally, the processor 110 is specifically configured to determine a weight value of the comment information corresponding to each text according to the number of likes of the comment information corresponding to each text; calculate the similarity between the comment information corresponding to each text and the text sentence of the corresponding text; and determine the scoring information of each text sentence according to the similarity, the weight value and the position information of each text sentence in the text.

[0212] Optionally, the second language model comprises a sub-language model and an updated encoder model. The processor 110 is further configured to, before inputting the data set into the second language model to obtain the second summary result, input the comment information corresponding to each text into the encoder model to obtain encoded comment data; input the text and the encoded comment data into the sub-language model to obtain a predicted summary result of each text; calculate a first loss function according to the predicted summary result of each text and the corresponding reference summary result; and update the parameters in the encoder model based on the first loss function by using a back propagation algorithm until convergence is achieved, to obtain the second language model.

[0213] Optionally, the second language model comprises an updated sub-language model. The processor 110 is further configured to, before inputting the text into the second language model to obtain the third summary result, divide the data set into a training set and a test set; update the parameters in the sub-language model according to the training set to obtain a third language model; input the test set into the third language model to obtain a predicted summary result of at least one text; calculate a second loss function according to the predicted summary result of each text and the corresponding reference summary result; and update the parameters in the third language model based on the second loss function by using a back propagation algorithm until convergence is achieved, to obtain the second language model.

[0214] Optionally, the processor 110 is further configured to, after inputting the text into the second language model to obtain the third summary result, obtain artificial scoring information of the first summary result, artificial scoring information of the second summary result, and artificial scoring information of the third summary result; calculate a third loss function according to the artificial scoring information of the first summary result, the artificial scoring information of the second summary result, and the artificial scoring information of the third summary result; and update the parameters in the sub-language model based on the third loss function by using a back propagation algorithm until convergence is achieved, to obtain a reward model.

[0215] The electronic device provided in the embodiments of the present application can implement each process achieved by the method embodiments described above, and achieve the same technical effects. To avoid repetition, details are not described herein.

[0216] The beneficial effects of various implementation manners in the embodiments can refer to the beneficial effects of the corresponding implementation manners in the method embodiments described above. To avoid repetition, details are not described herein.

[0217] It should be understood that in the embodiments of the present application, the input unit 104 can include a graphics processing unit (GPU) 1041 and a microphone 1042. The graphics processing unit 1041 processes image data of a still picture or a video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 can include a display panel 1061, which can be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 can include two parts of a touch detection device and a touch controller. The other input devices 1072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), a trackball, a mouse, a joystick, and the like, which will not be described here.

[0218] The memory 109 can be used to store software programs and various data. The memory 109 can mainly include a first storage area storing programs or instructions and a second storage area storing data, wherein the first storage area can store an operating system, application programs or instructions required by at least one function (such as a sound playing function, an image playing function, etc.), and the like. In addition, the memory 109 can include a volatile memory or a non-volatile memory, or the memory 109 can include both volatile and non-volatile memories. The non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link DRAM (SLDRAM), and a direct memory bus random access memory (Direct Rambus RAM, DRRAM). The memory 109 in the embodiments of the present application includes but is not limited to these and any other suitable types of memory.

[0219] The processor 110 can include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and an application program, and the modem processor mainly processes a wireless communication signal, such as a baseband processor. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 110.

[0220] The embodiment of the present application further provides a readable storage medium, and the readable storage medium stores a program or instructions, the program or instructions are executed by a processor to realize various processes of the above-mentioned method embodiments, and the same technical effects can be achieved, and details are not repeated here.

[0221] The processor is the processor in the electronic device in the above-mentioned embodiments. The readable storage medium includes a computer readable storage medium, such as a computer readable only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like.

[0222] The embodiment of the present application further provides a chip, and the chip includes a processor and a communication interface, the communication interface is coupled with the processor, and the processor is used to run a program or instructions to realize various processes of the above-mentioned method embodiments, and the same technical effects can be achieved, and details are not repeated here.

[0223] It should be understood that the chip mentioned in the embodiment of the present application can also be referred to as a system level chip, a system chip, a chip system, or a system on chip, and the like.

[0224] The embodiment of the present application provides a computer program product, and the program product is stored in a storage medium, and the program product is executed by at least one processor to realize various processes of the above-mentioned method embodiments, and the same technical effects can be achieved, and details are not repeated here.

[0225] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element. Furthermore, it is to be understood that the method and apparatus of the present application can be carried out by more than one process, method, article, or apparatus either simultaneously, concurrently, or with intervening action that are carried out at the same time, either in a simultaneous fashion or in a fashion that is interleaved in time. For example, the described methods can be performed in a different order from that described, and / or various steps can be combined or omitted, and / or additional steps can be added, without departing from the scope of the present application. Also, features described with respect to certain examples can be combined in other examples.

[0226] From the above description of the embodiments, it is apparent that the above-mentioned method can be realized by means of software and necessary universal hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solution of the present application can be embodied in the form of computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, or network equipment, etc.) execute the method described in various embodiments of the present application.

[0227] The embodiments of the present application are described above in conjunction with the drawings, but the present application is not limited to the above-described specific embodiments, and the above-described specific embodiments are merely illustrative, rather than limiting, and those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the scope protected by the claims.

Claims

1. A model training method, characterized in that, The method comprises: obtaining a data set, the data set comprising texts and comment information corresponding to each text; the comment information being comment information with a number of likes greater than a threshold value; inputting the data set into a first language model and a second language model to obtain a first summary result and a second summary result respectively, and inputting the text into the second language model to obtain a third summary result; each summary result comprising summary content of the text; inputting the first summary result, the second summary result and the third summary result into a reward model to obtain first scoring information of the first summary result, second scoring information of the second summary result and third scoring information of the third summary result; iteratively updating parameters in the second language model according to the first scoring information, the second scoring information and the third scoring information until convergence is achieved, to obtain a target model, the target model being used to extract summary content from a text.

2. The method of claim 1, wherein, inputting the data set into a first language model to obtain a first summary result, comprising: inputting the text and the comment information corresponding to each text into the first language model to segment each text to obtain more than one text sentence; scoring the text sentence corresponding to each text according to the comment information corresponding to each text to obtain scoring information of each text sentence; obtaining at least one text sentence from each text as summary content according to the scoring information of each text sentence to obtain the first summary result.

3. The method of claim 2, wherein, The scoring of the text sentence corresponding to each text according to the comment information corresponding to each text to obtain scoring information of each text sentence comprises: determining a weight value of the comment information corresponding to each text according to the number of likes of the comment information corresponding to each text; calculating the similarity between the comment information corresponding to each text and the text sentence of the corresponding text; determining the scoring information of each text sentence according to the similarity, the weight value and the position information of each text sentence in the text.

4. The method of claim 1, wherein, The second language model comprises a sub-language model and an updated encoder model; Before inputting the data set into the second language model to obtain a second summary result, the method further comprises: inputting the comment information corresponding to each text into the encoder model for encoding to obtain encoded comment data; inputting the text and the encoded comment data into the sub-language model to obtain a predicted summary result of each text; calculating a first loss function according to the predicted summary result of each text and the corresponding reference summary result; iteratively updating the parameters in the encoder model based on the first loss function using a back propagation algorithm until convergence is achieved to obtain the second language model.

5. The method of claim 1, wherein, The second language model comprises an updated sub-language model; Before inputting the text into the second language model to obtain a third summary result, the method further comprises: dividing the data set into a training set and a test set; updating parameters in the sub-language model according to the training set to obtain a third language model; inputting the test set into the third language model to obtain a predicted summary result of at least one of the texts; calculating a second loss function according to the predicted summary result of each of the texts and the corresponding reference summary result; updating parameters in the third language model iteratively until convergence by using a back propagation algorithm according to the second loss function to obtain the second language model.

6. The method of claim 1, wherein, After inputting the text into the second language model to obtain a third summary result, the method further comprises: obtaining artificial scoring information of the first summary result, artificial scoring information of the second summary result and artificial scoring information of the third summary result; calculating a third loss function according to the artificial scoring information of the first summary result, the artificial scoring information of the second summary result and the artificial scoring information of the third summary result; updating parameters in the sub-language model iteratively until convergence by using a back propagation algorithm according to the third loss function to obtain the reward model.

7. A model training apparatus characterized by comprising: The model training device comprises an obtaining module, an executing module and an updating module. The obtaining module is configured to obtain a data set, wherein the data set comprises texts and comment information corresponding to each of the texts; the comment information is comment information with a number of likes greater than a threshold value. The executing module is configured to input the data set obtained by the obtaining module into a first language model and a second language model to obtain a first summary result and a second summary result respectively, input the text into the second language model to obtain a third summary result, wherein each summary result comprises summary content of the text; and input the first summary result, the second summary result and the third summary result into a reward model to obtain first scoring information of the first summary result, second scoring information of the second summary result and third scoring information of the third summary result. The updating module is configured to update parameters in the second language model iteratively until convergence according to the first scoring information, the second scoring information and the third scoring information obtained by the executing module to obtain a target model, wherein the target model is used to extract summary content from a text.

8. The apparatus of claim 7, wherein, The executing module is specifically configured to input the text and the comment information corresponding to each of the texts into the first language model to segment each of the texts to obtain more than one text sentence; and score the text sentences corresponding to the text according to the comment information corresponding to each of the texts to obtain scoring information of each text sentence; and obtain at least one text sentence from each of the texts as summary content according to the scoring information of each text sentence to obtain the first summary result. The executing module is specifically configured to determine a weight value of the comment information corresponding to each of the texts according to the number of likes of the comment information corresponding to each of the texts; and calculate a similarity between the comment information corresponding to each of the texts and the text sentences corresponding to the text.

9. The apparatus of claim 8, wherein, ​ and according to the similarity, the weight value and position information of each text sentence in the text, determine scoring information of each text sentence.

10. The apparatus of claim 7, wherein, The second language model comprises a sub-language model and an updated encoder model. The execution module is further configured to input the comment information corresponding to each text into the encoder model for encoding to obtain encoded comment data before inputting the data set into the second language model to obtain a second summary result. and input the text and the encoded comment data into the sub-language model to obtain a predicted summary result of each text. The update module is further configured to calculate a first loss function according to the predicted summary result of each text and the corresponding reference summary result, and iteratively update parameters in the encoder model based on the first loss function until convergence is achieved to obtain the second language model.

11. The apparatus of claim 7, wherein, The second language model comprises an updated sub-language model. The execution module is further configured to divide the data set into a training set and a test set before inputting the text into the second language model to obtain a third summary result. The update module is further configured to update parameters in the sub-language model according to the training set to obtain a third language model. The execution module is further configured to input the test set into the third language model to obtain a predicted summary result of at least one text. The update module is further configured to calculate a second loss function according to the predicted summary result of each text and the corresponding reference summary result, and iteratively update parameters in the third language model based on the second loss function until convergence is achieved to obtain the second language model.

12. The apparatus of claim 7, wherein, The acquisition module is further configured to acquire artificial scoring information of the first summary result, artificial scoring information of the second summary result and artificial scoring information of the third summary result after inputting the text into the second language model to obtain a third summary result. The update module is further configured to calculate a third loss function according to the artificial scoring information of the first summary result, the artificial scoring information of the second summary result and the artificial scoring information of the third summary result, and iteratively update parameters in the sub-language model based on the third loss function until convergence is achieved to obtain the reward model.

13. An electronic device, comprising: A processor and a memory, the memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the model training method according to any one of claims 1 to 6.

14. A readable storage medium, characterized by, The readable storage medium stores programs or instructions, and the programs or instructions are executed by the processor to implement the steps of the model training method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method for generating pre-trained language model, electronic device and storage medium

    US20220350965A1

  • Text classification model training method, text classification method, apparatus, device, storage medium and computer program product

    US20230025317A1