An educational text summary method based on idempotent mechanism of large language model

By adopting idempotent mechanism and quantitative hybrid training technology in the education field, the problem of unstable summary length caused by high resource requirements of large language models and data scarcity has been solved, resource saving and summary quality improvement have been achieved, and the problem of missing or redundant information has been solved. remaining questions.

CN118211580BActive Publication Date: 2024-09-10WUHAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410332199.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-22
Publication Date
2024-09-10
Estimated Expiration
2044-03-22

AI Technical Summary

Technical Problem

The resource requirements of large-scale language models in the education field are too high, making it difficult to deploy and train, and the problems of data scarcity and unstable summary length are difficult to solve, resulting in missing or redundant information.

Method used

An idempotent mechanism based on a large language model is used to generate educational text summaries. By collecting multiple data sources, initializing corpus weights, constructing text summary templates, conducting fine-tuning training, and introducing quantitative hybrid training technology, adaptive amplification and idempotent summarization Generate modules to reduce the risk of over-fitting and improve summary length stability.

Benefits of technology

It reduces the resource requirements of large language models in the education field, improves the stability of summary length, enhances model generalization capabilities, avoids missing or redundant information, and improves the quality and efficiency of text summarization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118211580B
    Figure CN118211580B
Patent Text Reader

Abstract

The present invention provides an idempotent mechanism based on a large language model to generate an educational text summary method, which belongs to the field of artificial intelligence and natural language processing, including: collecting corpora from multiple data sources, selecting source texts to be summarized; constructing a text summary template; designing prompt words for downstream text summaries to form a first text summary; inputting the first text summary into a large language model to obtain a generated summary and a fine-tuning loss; randomly generating noise text according to the length of a word sequence to obtain an initial summary; filling the prompt words of the initial summary and the downstream text summary into the text summary template to form a third text summary, inputting the third text summary into the large language model, obtaining an idempotent summary and an idempotent loss; adding the idempotent loss to the fine-tuning loss to form an overall loss, using the convergence of the overall loss as a training cutoff condition, and completing the fine-tuning training of the large language model. The present invention can solve the problem of scarcity of vertical data in education and unstable summary length leading to missing or redundant information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence and natural language processing, and in particular relates to a method for generating educational text summaries based on an idempotent mechanism of a large language model. Background Art

[0002] With the rapid development of large language models (LLMs) in the field of natural language processing, their application in various fields has begun to show great value. In the process of digital transformation in the field of education, text work has always been an important issue. The traditional method of generating meeting minutes and organizing text materials has disadvantages such as uneven resource allocation, redundant steps, and low efficiency. At the same time, previous artificial intelligence models can only handle a single text summary task and cannot further process the summary after the model is summarized. In order to achieve the effect of further interactive processing of a single model after the text summary, it is necessary to introduce a general large language model with strong generalization ability.

[0003] However, simply using a small model to summarize the text to get a summary may be relatively simple, requiring less computing power and storage resources, which can be met by most education offices. However, the computing power and storage resources required for unprocessed large language models are often dozens to dozens of times that of small models, and graphics cards other than high-performance computing graphics cards are difficult to carry large language models. Therefore, it is of great practical significance to achieve lightweight large language models. It uses a quantization mechanism to perform mixed training on large language models to reduce the resource requirements of large language models.

[0004] However, due to the concerns of various universities about their own data security and privacy protection, the number of public text summary datasets available in the education field is quite limited, which can easily lead to underfitting during model training. Therefore, it is challenging to train models in this field when vertical domain data is scarce. Enhancing training data is an effective way to solve the problem of insufficient data. Most existing data enhancements focus on vocabulary replacement, random insertion, random exchange, and random deletion of text.

[0005] Performing data augmentation only on a limited number of vertical domain datasets may be effective on small models. However, since the large language model has been pre-trained, iterative training only on a single dataset after data augmentation may lead to "forgetting" of knowledge in the pre-training phase. Therefore, conventional single dataset data augmentation cannot meet our requirements. We need to perform adaptive augmentation on multiple datasets. On the one hand, datasets outside the education vertical domain help maintain the model's original understanding ability. On the other hand, multi-source training using datasets with different data distributions can reduce the risk of overfitting.

[0006] Existing text summarization methods also face the problem of insufficient data. For example, Li Jianzhi et al. combined extraction and generation models to propose a summary generation method based on scene and dialogue structure. However, due to the insufficient number of data sets, this design has limitations and is difficult to generalize to other fields or process complex language structures. It also increases the risk of semantic loss. Moreover, existing text summarization methods are often affected by the distribution of training source data. Training data sources with uneven data distribution lead to unstable summary length, resulting in missing or redundant information. How to maintain the stability of summary length when using multiple data sources with different data distributions for mixed training is a problem that must be solved. Summary of the invention

[0007] In view of this, the present invention provides a method for generating educational text summaries based on an idempotent mechanism of a large language model, which solves the problems of scarcity of vertical domain data and unstable summary length leading to missing or redundancy of information in the field of digital education, and adds quantitative hybrid training technology to enhance the application scope of the large language model.

[0008] The technical purpose of the present invention is achieved in this way:

[0009] The present invention provides a method for generating an educational text summary based on an idempotent mechanism of a large language model, comprising the following steps:

[0010] S1 collects corpora from multiple data sources, initializes corpus weights, and selects source texts to be summarized based on the corpus weights;

[0011] S2 constructs a text summary template, including a prompt word template and a source text template;

[0012] S3 designs prompt words for the downstream text summary, and fills the prompt words for the downstream text summary and the source text to be summarized into the text summary template to form a first text summary;

[0013] S4 inputs the first text summary into the large language model, performs word segmentation on the first text summary to obtain a word sequence, and converts the word sequence into an index table to fine-tune the large language model to obtain a generated summary and a fine-tuning loss;

[0014] S5 randomly generates noise text according to the length of the word sequence, fills the noise text into the text summary template as the source text, obtains a second text summary, and inputs the second text summary into the large language model to obtain an initial summary;

[0015] S6 fills the prompt words of the initial summary and the downstream text summary into the text summary template to form a third text summary, and inputs the third text summary into the large language model to obtain an idempotent summary and an idempotent loss;

[0016] S7 adds the idempotent loss to the fine-tuning loss to form the overall loss, takes the convergence of the overall loss as the training cutoff condition, and completes the fine-tuning training of the large language model.

[0017] Based on the above technical solution, preferably, step S1 includes:

[0018] S11 Collect corpus from multiple data sources D = D1, D2…D n , initialize the corpus weights W=W1, W2…W n , where n is the number of data sources;

[0019] S12 compares the corpus weights pairwise and selects the corpus of the best data source. The formula for pairwise comparison is:

[0020]

[0021] Among them, W i , W j Indicates D i , D j The corresponding corpus weight is , then select data source D i , and its corresponding text summary data (t i ,s i ) as the training object, if , then select data source D j , and its corresponding text summary data (t j ,s j ) as the training object, t represents the source text in the corresponding text summary data, and s represents the reference summary in the corresponding text summary data;

[0022] S13: Load the corpus of the optimal data source as the training target for training, calculate the gradient back propagation, adjust the corpus weight, and return to step S12 to re-compare the corpus weight;

[0023] S14 outputs a final batch of corpora of optimal data sources, and uses their source texts as source texts to be summarized.

[0024] Based on the above technical solution, preferably, in step S2, the text summary template is represented as T={prompt;t i ;s i}, which is composed of prompt words, source text to be summarized, and reference summary in sequence. The reasoning stage is represented by T={prompt;t i}, which consists of the prompt words and the source text to be summarized in sequence.

[0025] On the basis of the above technical solution, preferably, step S4 includes:

[0026] S41 creates a word segmenter to segment the first text summary, and the processed result is represented as a word segmentation table ;

[0027] S42 inputs the processed word segmentation table into a word segmenter, and maps the word segmentation table into an index table consisting entirely of numbers;

[0028] S43 creates a word embedding model and initializes the word embedding model;

[0029] S44 creates an MLP model, using Sequential containers to sequentially connect two linear layers and the Tanh activation function group layer MLP model;

[0030] S45 combines the word embedding model and the MLP model into a prefix encoder PrefixEncoder;

[0031] S46 randomly initializes the prefix token, inputs it into the prefix encoder PrefixEncoder, and obtains the prefix KV cache;

[0032] S47 freezes all gradients except the prefix encoder PrefixEncoder during the training phase;

[0033] S48 predicts the generated summary, compares it with the reference summary, and calculates the fine-tuning loss.

[0034] Based on the above technical solution, preferably, step S46 is expressed as the following formula:

[0035] ;

[0036] in, Indicates the prompt word, h0,..,h i is a trainable embedding vector that is a representation of the prompt word The result after encoding, x represents the source text that needs to be summarized, y represents the summary, e represents the encoding process, and T represents the text summary template.

[0037] Based on the above technical solution, preferably, the fine-tuning loss is:

[0038] ;

[0039] in, is the summary generated by the model prediction, s is the reference summary in the training corpus, and CrossEntropyLoss is the cross entropy function.

[0040] Based on the above technical solution, preferably, step S5 includes:

[0041] S51 Based on the source text t in the training corpus i The length of a noise text ni is randomly generated using a distribution function;

[0042] S52 Fill the noise text into the position of the source text in the pre-designed text summary template to obtain a second text summary T ni ;

[0043] S53 After model prediction, the second text summary T ni Predicted to be the first summary , the formula is:

[0044] ;

[0045] in is the prediction result of the large model, that is, the initial summary, f represents each layer of the large language model, and ni is the noise text.

[0046] Based on the above technical solution, preferably, step S6 includes:

[0047] The initial summary Treat it as the source text to be summarized, fill it into the text summary template, and obtain the third text summary ;

[0048] The large language model receives the third text summary as input and obtains the idempotent summary through prediction at each layer. The specific formula is:

[0049] ;

[0050] in, is an idempotent summary, which is obtained by predicting the noisy text twice through the large language model, and f represents each layer of the large model;

[0051] The idempotent loss is obtained by measuring the initial summary and the idempotent summary according to the second loss function.

[0052] Based on the above technical solution, preferably, the idempotent loss is:

[0053] ;

[0054] ;

[0055] Where D represents the distance measurement method on the target distribution where the summary is located, that is, the L2 measurement, which is used to measure the initial summary With idempotent summary The degree of drift on the target distribution, Indicates idempotency loss.

[0056] Based on the above technical solution, preferably, the overall loss expression is:

[0057] ;

[0058] in, is the fine-tuning loss, It is an idempotent loss.

[0059] The method of the present invention has the following beneficial effects compared with the prior art:

[0060] The present invention proposes a method of adaptively loading data sources and corpora, which allows the model to freely select training data according to the training situation while maintaining the same test standard without changing the test set, thereby allowing the large model to be migrated to the text summarization task and reducing the risk of overfitting;

[0061] The present invention generates an idempotent summary and improves the stability of the summary length by shortening the distance between the initial summary and the idempotent summary. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0063] Figure 1 is a flow chart of a method according to an embodiment of the present invention;

[0064] Figure 2 A schematic diagram of a network model structure of an embodiment of the present invention;

[0065] Figure 3 The figure is a schematic diagram of forming a text summary according to an embodiment of the present invention. DETAILED DESCRIPTION

[0066] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0067] like Figure 1 As shown, the present invention provides a method for generating an educational text summary based on an idempotent mechanism of a large language model, comprising the following steps:

[0068] S1 collects corpora from multiple data sources, initializes corpus weights, and selects source texts to be summarized based on the corpus weights;

[0069] S2 constructs a text summary template, including a prompt word template and a source text template;

[0070] S3 designs prompt words for the downstream text summary, and fills the prompt words for the downstream text summary and the source text to be summarized into the text summary template to form a first text summary;

[0071] S4 inputs the first text summary into the large language model, performs word segmentation on the first text summary to obtain a word sequence, and converts the word sequence into an index table to fine-tune the large language model to obtain a generated summary and a fine-tuning loss;

[0072] S5 randomly generates noise text according to the length of the word sequence, fills the noise text into the text summary template as the source text, obtains a second text summary, and inputs the second text summary into the large language model to obtain an initial summary;

[0073] S6 fills the prompt words of the initial summary and the downstream text summary into the text summary template to form a third text summary, and inputs the third text summary into the large language model to obtain an idempotent summary and an idempotent loss;

[0074] S7 adds the idempotent loss to the fine-tuning loss to form the overall loss, takes the convergence of the overall loss as the training cutoff condition, and completes the fine-tuning training of the large language model.

[0075] The technical idea of ​​the present invention is: the present invention solves the problem of scarcity of vertical domain data in the field of education digitization, unstable summary length leading to missing or redundant information, and adds quantitative hybrid training technology to enhance the application scope of large language models. The traditional generative text summarization method is trained in a single data source and inferred on the test set of the same data source. The features learned by the model are highly consistent with the distribution of training data. Even if the model receives a longer source text, it tends to generate a longer summary, even if this is very different from the reference summary length. The same is true when the model receives a shorter source text. The present invention proposes an adaptive expansion module, which allows the model to freely select training data according to the training situation while maintaining the same test standard without changing the test set, so that the large model can be migrated to the text summary task and reduce the risk of overfitting. In addition, an idempotent summary generation module is proposed to improve the stability of the summary length by narrowing the distance between the initial summary and the idempotent summary. If the computing power and storage resources required by the model are too large, it will increase the difficulty of model deployment and the speed of reasoning. At the same time, a quantization technology that speeds up the training reasoning speed but does not significantly reduce the training reasoning effect is introduced, and training reasoning is assisted by hybrid training.

[0076] Specifically, in one embodiment of the present invention, step S1 includes:

[0077] S11 Collect corpus from multiple data sources D = D1, D2…D n , initialize the corpus weights W=W1, W2…W n , where n is the number of data sources;

[0078] S12 compares the corpus weights pairwise and selects the corpus of the best data source. The formula for pairwise comparison is:

[0079]

[0080] Among them, W i , W j Indicates D i , D j The corresponding corpus weight is , then select data source D i , and its corresponding text summary data (t i ,s i ) as the training object, if , then select data source D j , and its corresponding text summary data (t j ,s j ) as the training object, t represents the source text in the corresponding text summary data, and s represents the reference summary in the corresponding text summary data;

[0081] S13: Load the corpus of the optimal data source as the training target for training, calculate the gradient back propagation, adjust the corpus weight, and return to step S12 to re-compare the corpus weight;

[0082] S14 outputs a final batch of corpora of optimal data sources, and uses their source texts as source texts to be summarized.

[0083] Let's use a specific example to illustrate:

[0084] Prepare multiple text summary data sets involving general fields and education vertical fields, and process the data set format to ensure that the data format meets the requirements of large model fine-tuning. This embodiment uses three data sets, namely LCSTS, NLPCC2017 and EDUCATION. LCSTS comes from Sina Weibo and is collected by Harbin Institute of Technology. The LCSTS data set is divided into three parts, of which the training set contains 2400591 samples, the validation set contains 10666 samples, and the test set contains samples with a score greater than or equal to 3. The NLPCC data set was officially released by the Conference on Natural Language Processing and Chinese Computing, in which the training set contains 50,000 samples, and the validation set and test set contain 2000 samples. The EDUCATION data set mainly contains historical articles from mainstream vertical media in the field of education and training, totaling approximately 24,500 data. The general domain shown in this embodiment is a relative concept, which refers to other data sets that are all-encompassing and do not focus on a certain field, relative to the specialized education data set. Taking the three selected data sets as an example, EDUCATION is the vertical domain of education, LCSTS and NLPCC involve news, politics, economy, military, movies, games, etc., and belong to the general field.

[0085] Initialize corpus weights for multiple data sources, for example, LCSTS, NLPCC 2017 and EDUCATION are data sources. Different data sets have different data distributions, which means that the corpus in different data sources has different effects on model training. Compare the corpus weights to select the source text to be summarized. Specifically:

[0086] Initialize multiple corpus weights W1, W2…W n , corresponding to each data source; comparing W1, W2…W n Relative size, select the corpus in the data source corresponding to the maximum expected weight (t i ,s i ). Taking two data sources as an example, the specific steps are as follows:

[0087]

[0088] Among them, W i , W j Indicates D i , D j The corresponding corpus weight is , then select data source D i , and its corresponding text summary data (t i ,s i ) as the training object, if , then select data source D j , and its corresponding text summary data (t j ,s j) as the training object, t represents the source text in the corresponding text summary data, and s represents the reference summary in the corresponding text summary data;

[0089] Load the training corpus, calculate the gradient back propagation, adjust the corpus weight, and re-compare the corpus size.

[0090] Specifically, in one embodiment of the present invention, in step S2, the text summary template in the training stage is represented as T={prompt;t i ;s i}, which is composed of prompt words, source text to be summarized, and reference summary in sequence. The reasoning stage is represented by T={prompt;t i}, which consists of the prompt words and the source text to be summarized in sequence.

[0091] In a specific embodiment, step S3 includes:

[0092] Prompt words are designed according to downstream tasks. Here, the prompt word is "You are now an article summary model. Please summarize the text into short words. Text: ". By allowing the large language model to play roles, the model is prompted with task scenarios, thereby migrating the model's general knowledge to specific fields. In different usage scenarios, different prompt words are needed to help the model understand the current task.

[0093] Specifically, in one embodiment of the present invention, step S4 includes:

[0094] S41 creates a word segmenter to segment the first text summary, and the processed result is represented as a word segmentation table ;

[0095] S42 inputs the processed word segmentation table into a word segmenter, and maps the word segmentation table into an index table consisting entirely of numbers;

[0096] S43 creates a word embedding model and initializes the word embedding model;

[0097] S44 creates an MLP model, using Sequential containers to sequentially connect two linear layers and the Tanh activation function group layer MLP model;

[0098] S45 combines the word embedding model and the MLP model into a prefix encoder PrefixEncoder;

[0099] S46 randomly initializes the prefix token, inputs it into the prefix encoder PrefixEncoder, and obtains the prefix KV cache;

[0100] S47 freezes all gradients except the prefix encoder PrefixEncoder during the training phase;

[0101] S48 predicts the generated summary, compares it with the reference summary, and calculates the fine-tuning loss.

[0102] Let's take a specific example to illustrate:

[0103] Create a ChatGLM tokenizer, load the tokenizer weights of the pre-trained model, and use the BBPE algorithm to tokenize the text summary template T. The result after processing can be expressed as .

[0104] The processed word segmentation table is input into the word segmenter again, and the word segmentation table is mapped into an index table composed entirely of numbers.

[0105] Create a word embedding model word_embeddings, input the vocabulary size and hidden dimension size to initialize the word embedding model.

[0106] Create an MLP model and use Sequential containers to sequentially connect two linear layers and the Tanh activation function to form an MLP module.

[0107] The word embedding model word_embeddings created above and the MLP model form a prefix encoder PrefixEncoder.

[0108] Randomly initialize the prefix token and input it into the prefix encoder PrefixEncoder to obtain the prefix KV cache. The specific formula is:

[0109]

[0110] in, Indicates the prompt word, h0,..,h i is a trainable embedding vector that is a representation of the prompt word The result after encoding, x represents the source text that needs to be summarized, y represents the summary, e represents the encoding process, and T represents the text summary template.

[0111] During the training phase, all gradients except for the prefix encoder PrefixEncoder are frozen.

[0112] After the model predicts, the generated summary is obtained. The cross entropy receives the generated summary and the reference summary as input, and calculates the fine-tuning loss. The specific formula is as follows:

[0113]

[0114] in, is the summary generated by the model predictions, is a reference summary in the training corpus, is the cross entropy function.

[0115] Specifically, in one embodiment of the present invention, step S5 includes:

[0116] S51 Based on the source text t in the training corpus i The length of a noise text ni is randomly generated using a distribution function;

[0117] S52 Fill the noise text into the position of the source text in the pre-designed text summary template to obtain a second text summary T ni ;

[0118] S53 After model prediction, the second text summary T ni Predicted to be the first summary , the formula is:

[0119] ;

[0120] in, is the prediction result of the large language model, that is, the initial summary, f represents each layer of the large language model, and ni is the noise text.

[0121] Let's use a specific example to illustrate:

[0122] The length of the source text in the input of the current model is L t , keep the length unchanged, use uniform distribution function, normal distribution function or text word frequency distribution to generate a segment of length L t Noise text.

[0123] The length is L t The noise text is filled into the position of the source text in the pre-designed text summary template to obtain the second text summary T ni .

[0124] After the model prediction head, the second text summary T ni Predicted to be the first summary , the formula is:

[0125]

[0126] in, is the prediction result of the large model, that is, the initial summary, f represents each layer of the large model, and ni is the noise text.

[0127] Specifically, in one embodiment of the present invention, step S6 includes:

[0128] The initial summary Treat it as the source text to be summarized, fill it into the text summary template, and obtain the third text summary ;

[0129] The large language model receives the third text summary as input and obtains the idempotent summary through prediction at each layer. The specific formula is:

[0130] ;

[0131] in, is an idempotent summary, which is obtained by predicting the noisy text twice through the large language model, and f represents each layer of the large model;

[0132] The idempotent loss is obtained by measuring the initial summary and the idempotent summary according to the second loss function.

[0133] Let's use a specific example to illustrate:

[0134] The initial summary Treat it as the source text to be summarized, fill it into the template, and obtain the third text summary .

[0135] The large language model receives the third text summary as input and obtains the idempotent summary through prediction at each layer. The specific formula is:

[0136] ;

[0137] in, is an idempotent summary, which is obtained by predicting the noisy text twice through a large language model, and f represents each layer of the large model.

[0138] Define the distribution of the source text and the distribution of the summary as the source distribution and the target distribution respectively. Then the reasoning process of the "model summary" should meet the following characteristics: the source text is mapped from the source distribution to the target distribution, and the summary that has been projected to the target distribution is repeatedly projected, and the projection result is still in the target distribution. Here, the idempotent summary and the initial summary are located in adjacent positions in the target distribution. Therefore, an idempotent loss function is constructed to calculate the distance between the idempotent summary and the initial summary in the target distribution.

[0139] Constructing idempotent loss function for:

[0140]

[0141]

[0142] Where D represents the distance measurement method on the target distribution where the summary is located, which is used to measure the initial summary With idempotent summary The degree of drift on the target distribution, here the L2 metric is used.

[0143] Add the idempotent loss to the main branch of fine-tuning loss to calculate the overall loss.

[0144] Constructed loss function for:

[0145] ;

[0146] in, is the fine-tuning loss, It is an idempotent loss.

[0147] The present invention automatically loads the current training source text and summary according to the model training situation through an adaptive expansion module, uses the knowledge of the education vertical domain and other broad fields to fine-tune the model, maintains the model's previous knowledge while enhancing the summary effect in the education vertical domain, and proposes an idempotent summary generation strategy by utilizing the idempotence of the summary being re-mapped and still in the target distribution, thereby shortening the distance between the idempotent summary and the initial summary, thereby stabilizing the length of the summary.

[0148] The present invention can generate summaries with more stable lengths for users. At the same time, users can freely define the ratio of vertical domain knowledge to broad knowledge, and can fully integrate vertical domain knowledge according to user needs to achieve the effect of generating summaries containing more specific knowledge.

[0149] In order to verify the effectiveness of the method proposed in the present invention, the present invention applies the ChatGLM-based method, the method using only downstream fine-tuning, the method using only adaptive amplification, and the corresponding complete method of the present invention to the text summarization of the same source text. Figure 2 The figure shows a schematic diagram of the network model structure used in the method of generating length-stable educational text summaries using the idempotent mechanism during the fine-tuning of a large language model. The method mainly includes an adaptive amplification module, a fine-tuning module, a baseline model, and an idempotent module. The contents executed by each module are as described in the above steps S1-S7. Figure 3 The schematic diagram of the principle used in the formation of text summaries is shown, which mainly includes source distribution, target distribution, and mapping. The complete method of the present invention combines fine-tuning technology, adaptive amplification, and idempotent summary generation mechanism. By comparing the experimental results, the evaluation index table shown in Table 1 is obtained.

[0150] Table 1 Evaluation index table

[0151]

[0152] ROUGE-1, ROUGE-2 and ROUGE-L are all evaluation indicators. As shown in Table 1, the evaluation indicators of the complete method of the present invention are the best, which proves the superiority of the method proposed by the present invention.

[0153] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for generating educational text summarization based on an idempotent mechanism of a large language model. It is characterized in that The following steps are involved: S1 collects corpora from multiple data sources, initializes corpus weights, and selects source texts to be summarized based on the corpus weights; S2 constructs a text summary template, including a prompt word template and a source text template; S3 designs prompt words for the downstream text summary, and fills the prompt words for the downstream text summary and the source text to be summarized into the text summary template to form a first text summary; S4 inputs the first text summary into the large language model, performs word segmentation on the first text summary to obtain a word sequence, and converts the word sequence into an index table to fine-tune the large language model to obtain a generated summary and a fine-tuning loss; S5 randomly generates noise text according to the length of the word sequence, fills the noise text into the text summary template as the source text, obtains a second text summary, and inputs the second text summary into the large language model to obtain an initial summary; S6 fills the prompt words of the initial summary and the downstream text summary into the text summary template to form a third text summary, and inputs the third text summary into the large language model to obtain an idempotent summary and an idempotent loss; S7 adds the idempotent loss to the fine-tuning loss to form the overall loss, takes the convergence of the overall loss as the training cutoff condition, and completes the fine-tuning training of the large language model; Step S1 includes: S11 Collect corpus from multiple data sources D=D 1 , D 2 …D n , initialize the corpus weight W=W 1 , W 2 …W n , where n is the number of data sources; S12 compares the corpus weights pairwise and selects the corpus of the best data source. The formula for pairwise comparison is: ; Among them, W i , W j Indicates D i , D j The corresponding corpus weight is , then select data source D i , and its corresponding text summary data (t i ,s i ) as the training object, if , then select data source D j , and its corresponding text summary data (t j ,s j ) as the training object, t represents the source text in the corresponding text summary data, and s represents the reference summary in the corresponding text summary data; S13: Load the corpus of the optimal data source as the training target for training, calculate the gradient back propagation, adjust the corpus weight, and return to step S12 to re-compare the corpus weight; S14 outputs a final batch of corpora of optimal data sources, and uses the source texts as source texts to be summarized; Step S4 includes: S41 creates a word segmenter to segment the first text summary, and the processed result is represented as a word segmentation table ; S42 inputs the processed word segmentation table into a word segmenter, and maps the word segmentation table into an index table consisting entirely of numbers; S43 creates a word embedding model and initializes the word embedding model; S44 creates an MLP model, using Sequential containers to sequentially connect two linear layers and the Tanh activation function group layer MLP model; S45 combines the word embedding model and the MLP model into a prefix encoder PrefixEncoder; S46 randomly initializes the prefix token, inputs it into the prefix encoder PrefixEncoder, and obtains the prefix KV cache; S47 freezes all gradients except the prefix encoder PrefixEncoder during the training phase; S48 predicts the generated summary, compares it with the reference summary, and calculates the fine-tuning loss.

2. The method for generating educational text summarization based on the idempotent mechanism of a large language model as claimed in claim 1, It is characterized in that In step S2, the text summary template in the training phase is represented as T = {prompt;t i ;s i }, which is composed of prompt words, source text to be summarized, and reference summary in sequence. The reasoning stage is represented by T={prompt;t i }, which consists of the prompt words and the source text to be summarized in sequence.

3. The method for generating educational text summarization based on the idempotent mechanism of a large language model as claimed in claim 1, It is characterized in that Step S46 is expressed as a formula as follows: ; in, Indicates the prompt word, h 0 ,..,h i is a trainable embedding vector that is a representation of the prompt word The result after encoding, x represents the source text that needs to be summarized, y represents the summary, e represents the encoding process, and T represents the text summary template.

4. The method for generating educational text summarization based on the idempotent mechanism of a large language model as claimed in claim 1, It is characterized in that The fine-tuning loss is: ; in, is the summary generated by the model prediction, s is the reference summary in the training corpus, and CrossEntropyLoss is the cross entropy function.

5. The method for generating educational text summarization based on the idempotent mechanism of a large language model as claimed in claim 1, It is characterized in that Step S5 includes: S51 Based on the source text t in the training corpus i The length of a noise text ni is randomly generated using a distribution function; S52 Fill the noise text into the position of the source text in the pre-designed text summary template to obtain a second text summary T ni ; S53 After model prediction, the second text summary T ni Predicted to be the first summary , the formula is: ; in, is the prediction result of the large language model, that is, the initial summary, f represents each layer of the large language model, and ni is the noise text.

6. The method for generating educational text summarization based on the idempotent mechanism of a large language model as claimed in claim 5, It is characterized in that Step S6 includes: The initial summary Treat it as the source text to be summarized, fill it into the text summary template, and obtain the third text summary ; The large language model receives the third text summary as input and obtains the idempotent summary through prediction at each layer. The specific formula is: ; in, is an idempotent summary, which is obtained by predicting the noisy text twice through the large language model, and f represents each layer of the large model; The idempotent loss is obtained by measuring the initial summary and the idempotent summary according to the second loss function.

7. The method for generating educational text summarization based on the idempotent mechanism of a large language model as claimed in claim 6, It is characterized in that The idempotent loss is: ; ; Where D represents the distance measurement method on the target distribution where the summary is located, that is, the L2 measurement, which is used to measure the initial summary With idempotent summary The degree of drift on the target distribution, Indicates idempotency loss.

8. The method for generating educational text summarization based on the idempotent mechanism of a large language model as claimed in claim 7, It is characterized in that The overall loss expression is: ; in, is the fine-tuning loss, It is an idempotent loss.