Method and device for training segment-level recurrent Transformer model based on exponential memory enhancement

By introducing memory tokens and fragment-level segmentation mechanisms into the Transformer model, the problem of traditional Transformer's difficulty in extracting global features from long text input is solved, efficient processing and parallel computing of long sequence data are achieved, and language modeling performance is improved.

CN118194042BActive Publication Date: 2024-09-24HUBEI LUOJIA ZHIYAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410347658.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-26
Publication Date
2024-09-24
Estimated Expiration
2044-03-26

AI Technical Summary

Technical Problem

The traditional Transformer model is difficult to effectively extract global features when processing long text input, and has high computational complexity, making it difficult to apply to long text input.

Method used

The fragment-level cyclic Transformer model training method based on exponential memory enhancement is adopted. By introducing 'memory token' into the input sequence, the input sequence is divided into fragments, and exponential cyclic connections are made between the fragments to update the memory state and eliminate the length of the input sequence. restrictions.

Benefits of technology

It effectively extracts global features, eliminates the limitation of input sequence length, improves the model's ability to process long sequence data, maintains parallel computing, and performs better than traditional Transformers in language modeling and complex tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118194042B
    Figure CN118194042B
Patent Text Reader

Abstract

The present invention discloses a method and device for training a segment-level recurrent Transformer model based on exponential memory enhancement, firstly constructing a training data set, wherein the data in the training data set includes high-quality general text data and partial domain data; then performing segment-level segmentation processing on the data in the training data set to obtain input sequence data; then adding a "memory token" to the input sequence data to implement a memory mechanism, obtaining processed high-quality general text data and processed domain data; finally using the processed general text data to pre-train the Transformer model until the training meets the convergence condition; and fine-tuning the Transformer model with the processed domain data until the training meets the convergence condition. The present invention can effectively extract global features and solve the problem of long text input.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology and relates to a Transformer model training method and device, and specifically to a fragment-level cyclic Transformer model training method and device based on exponential memory enhancement. Background Art

[0002] The current Transformer model has shown its effectiveness in various fields and tasks. The key component, the self-attention mechanism, integrates the information of all elements in the sequence into a context-aware representation, so that each token can obtain a rich contextual representation after encoding. However, the traditional self-attention mechanism stores both global and local features in the representation of a single token, and the global features are stored separately in all token representations, making the global features "fuzzy" and difficult to access. In addition, the computational complexity of the self-attention mechanism is the square of the input length, which also makes the traditional Transformer model difficult to apply to long text inputs. Summary of the invention

[0003] In order to solve the problem of effectively extracting global features and long text input, the present invention proposes a fragment-level recurrent Transformer training method and device based on exponential memory enhancement.

[0004] The technical solution adopted by the method of the present invention is: a segment-level recurrent Transformer model training method based on exponential memory enhancement, comprising the following steps:

[0005] Step 1: Construct a training data set, wherein the data in the training data set includes general text data and partial domain data;

[0006] Step 2: Perform segmentation processing on the data in the training dataset to obtain input sequence data;

[0007] Step 3: Add "memory token" to the input sequence data to implement the memory mechanism and obtain the processed general text data and processed domain data;

[0008] For a given input segment τ, add [mem]token to augment the input. The [mem]token is processed in the same way as other tokens in the sequence. Each [mem]token is a real vector representing the token in each segment. Add m [mem] tokens to the front of At the same time, add m [mem] token representations at the end

[0009]

[0010]

[0011] in, is the initial value, m is the hyperparameter, and N is the number of layers of Transformer;

[0012] The [mem] token group at the beginning of the segment is for reading memory The sequence tokens of the next segment are allowed to notice the memory state of the previous segment; the [mem] token group at the end of the segment is written to the memory Able to focus on all token representations of the current segment and update the representation stored in memory

[0013]

[0014] Step 4: Use the processed general text data to pre-train the Transformer model until the training meets the convergence condition;

[0015] Step 5: Fine-tune the Transformer model with the processed domain data until the training meets the convergence conditions.

[0016] Preferably, the specific implementation of step 1 includes the following sub-steps:

[0017] Step 1.1: Given a series of prompt-answer text pairs The prompt is denoted by x i , the corresponding answer is denoted as y i ,There are n pairs in the dataset; the prompts contain both general knowledge text data and specific domain knowledge text data;

[0018] Step 1.2: For the original prompt-answer text pair, perform data cleaning preprocessing, including deduplication, removal of short text, deletion of redundant information, and adding "#question:" at the beginning of the prompt text as the start mark of the prompt, and adding "#answer:" at the beginning of the answer text as the start mark of the answer, and adding a line break between the prompt and the answer to distinguish them.

[0019] Preferably, in step 2, for each pair of prompt texts in the training data set (x i ,y i ), they are concatenated into a whole text sequence, and the input text sequence is divided into fixed-size segments in sequence, with a segment length of τ, and the part less than the length of τ is taken as a separate segment.

[0020] Preferably, in step 3, the segments of the input sequence data are processed in order. To achieve exponential loop connection between segments, two different operations are performed on the [mem] token group of the previous segment according to the position of the current segment:

[0021] Operation 1: When the current segment is at the exponential position 2, that is, τ = 2 k ,k=1,2,…,n, then the [mem]token group of the previous segment is updated and used as the memory segment of the current segment:

[0022]

[0023]

[0024] Among them, σ is the activation function, W and b are learnable parameters of the transformer output linear layer parameters;

[0025] Operation 2: When the current fragment is not at the exponential position of 2, that is, τ≠2 k ,k=1,2,…,n, then directly inherit the [mem]token group of a fragment as the memory fragment of the current fragment:

[0026]

[0027]

[0028] Preferably, the specific implementation of step 4 includes the following sub-steps:

[0029] Step 4.1: Select a part of training samples from the processed general text dataset and record it as D g ;

[0030] Step 4.2: Each sentence in the sequence is used as both the input of the Transformer model and the predicted label. For a sequence s i , the token contained in it is When the training data input is When k As the label of this data,

[0031]

[0032] y 1 ,y 2 ,…,y n represents the token at position 1, 2, ..., n, y t represents the token at the tth position, n represents the total length of the sequence, k represents the kth position of the sequence, and y <tis the output before time t;

[0033] Step 4.3: Calculate the Transformer model in D according to the following loss function formula g The loss on , and get its gradient, and use the gradient descent algorithm to update the Transformer model parameters:

[0034]

[0035]

[0036] Among them, θ is the parameter of the Transformer model, x is the input sequence, N is the output sequence length, Indicates the gradient of the model parameter θ;

[0037] Step 4.4: Repeat steps 4.1 to 4.3 until the training meets the convergence conditions.

[0038] Preferably, the specific implementation of step 5 includes the following sub-steps:

[0039] Step 5.1: Select a portion of training samples from the processed domain dataset and record them as D d ;

[0040] Step 5.2: Calculate the Transformer model in D according to the following loss function formula d The loss on , and get its gradient, and use the gradient descent algorithm to update the Transformer model parameters:

[0041]

[0042]

[0043] Among them, θ is the parameter of the Transformer model, x is the input sequence, and y <t is the output before time t, and N is the length of the output sequence; Indicates the gradient of the model parameter θ;

[0044] Step 5.3: Repeat steps 5.1 to 5.2 until the training meets the convergence conditions.

[0045] Preferably, the Transformer model is a segment-level recurrent Transformer model;

[0046] The segment-level recurrent Transformer model includes a Transformer module and a linear layer module;

[0047] The Transformer module is a multi-layer Transformer stack structure that only contains a decoder, including an input layer and a multi-layer sub-Transformer module arranged in series; the input layer is an embedding layer, which is used to convert each received token into a corresponding embedding feature vector; each of the sub-Transformer modules includes, in order, a first layer_norm layer, a self-attention layer, a first residual connection layer, a second layer_norm layer, a fully connected layer, a second residual connection layer and an output layer; the first layer_norm layer is used to perform layer normalization processing on the input; the self-attention layer is used to learn the contextual semantic features of the sentence; the first residual connection layer is used to add the outputs of the first two layers; the second layer_norm layer, which performs layer normalization on the result of the residual connection; the fully connected layer is used to perform a linear transformation on the normalized result; the second residual connection layer is used to add the outputs of the first two layers; the output layer is a fully connected layer, which converts the calculated result into a probability value for each token and outputs the token with the highest probability;

[0048] The linear layer is used to update the [mem] token group of the previous data fragment at the index position and use it as the memory fragment of the next data fragment.

[0049] The technical solution adopted by the device of the present invention is: a fragment-level recurrent Transformer model training device based on exponential memory enhancement, comprising:

[0050] one or more processors;

[0051] A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the exponential memory-enhanced fragment-level recurrent Transformer model training method.

[0052] Compared with the prior art, the beneficial effects of the present invention include:

[0053] (1) The present invention proposes an exponential memory enhancement method, which provides additional storage capacity for the model by introducing specific "memory tokens" into the input sequence, so that the model can process information that is not directly expressed in any token.

[0054] (2) In order to process long sequences, this method divides the input sequence into segments and updates the memory state from the previous segment to the current segment according to the exponential update strategy, which makes it recursive and eliminates the limitation of the input sequence length. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The technical solution of the present invention is further described below using embodiments and specific implementation methods. In addition, in the process of describing the technical solution, some drawings are also used. For those skilled in the art, other drawings and the intention of the present invention can also be obtained based on these drawings without paying creative work.

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

[0057] Figure 2 This is a Transformer model framework diagram of an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to facilitate ordinary technicians in the field to understand and implement the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0059] Please see Figure 1 and Figure 2 , a segment-level recurrent Transformer model training method based on exponential memory enhancement provided in this embodiment includes the following steps:

[0060] Step 1: Construct a training data set, wherein the data in the training data set includes high-quality general text data and partial domain data;

[0061] In one embodiment, the specific implementation of step 1 includes the following sub-steps:

[0062] Step 1.1: Given a series of prompt-answer text pairs The prompt is denoted as x, and the corresponding answer is denoted as y. There are n pairs in the dataset. The prompt contains both general knowledge text data and specific domain knowledge text data, including essays, codes, news, etc. The corresponding data volume is approximately 5.8M and 1M.

[0063] Step 1.2: For the original prompt text pair, data cleaning preprocessing is required, including deduplication, removal of short texts, deletion of redundant information, etc., and "#question:" is added at the beginning of the prompt text as the start mark of the prompt, and "#answer:" is added at the beginning of the answer text as the start mark of the answer. Multiple line breaks are added between the prompt and the answer to distinguish them.

[0064] Step 2: Perform segmentation processing on the data in the training dataset to obtain input sequence data;

[0065] In one embodiment, for each pair of prompt texts in the training data set (x i,y i ), they are concatenated into a whole text sequence, and the input text sequence is divided into fixed-size segments in sequence, with a segment length of τ, and the part less than the length of τ is taken as a separate segment.

[0066] Transformer model each layer fragment The hidden layer output will serve as the input of the next layer, that is:

[0067]

[0068] Step 3: Add "memory tokens" to the input sequence data to implement the memory mechanism and obtain processed high-quality general text data and processed domain data;

[0069] In one embodiment, for a given input segment τ, a [mem] token is added to augment the input, and the [mem] token is processed in the same way as other tokens in the sequence; each [mem] token is a real vector, and the token representation in each segment Add m [mem] tokens to the front of At the same time, add m [mem] token representations at the end

[0070]

[0071]

[0072] in, is the initial value, m is the hyperparameter, and N is the number of layers of Transformer;

[0073] The [mem] token group at the beginning of the segment is for reading memory The sequence tokens of the next segment are allowed to notice the memory state of the previous segment; the [mem] token group at the end of the segment is written to the memory Able to focus on all token representations of the current segment and update the representation stored in memory

[0074]

[0075] In one embodiment, the segments of the input sequence data are processed in order. To achieve exponential loop connection between segments, two different operations are performed on the [mem] token group of the previous segment according to the position of the current segment:

[0076] Operation 1: When the current segment is at the exponential position 2, that is, τ = 2 k ,k=1,2,…,n, then the [mem]token group of the previous segment is updated and used as the memory segment of the current segment:

[0077]

[0078]

[0079] Among them, σ is the activation function, W and b are learnable parameters of the transformer output linear layer parameters;

[0080] Operation 2: When the current fragment is not at the exponential position of 2, that is, τ≠2 k ,k=1,2,…,n, then directly inherit the [mem]token group of a fragment as the memory fragment of the current fragment:

[0081]

[0082]

[0083] Step 4: Use the processed high-quality general text data to pre-train the Transformer model until the training meets the convergence condition;

[0084] In one embodiment, step 4.1: select a portion of training samples from the processed general text dataset and record them as D g ;

[0085] Step 4.2: Each sentence in the sequence is used as both the input of the Transformer model and the predicted label. For a sequence s i , the token contained in it is When the training data input is When k As the label of this data,

[0086]

[0087] y 1 ,y 2 ,…,y n represents the token at position 1, 2, ..., n, y t represents the token at the tth position, n represents the total length of the sequence, k represents the kth position of the sequence, and y <t is the output before time t;

[0088] Step 4.3: Calculate the Transformer model in D according to the following loss function formulag The loss on , and get its gradient, and use the gradient descent algorithm to update the Transformer model parameters:

[0089]

[0090]

[0091] Among them, θ is the parameter of the Transformer model, x is the input sequence, N is the output sequence length, Indicates the gradient of the model parameter θ;

[0092] Step 4.4: Repeat steps 4.1 to 4.3 until the training meets the convergence conditions.

[0093] Step 5: Fine-tune the Transformer model with the processed domain data until the training meets the convergence conditions.

[0094] In one embodiment, the specific implementation of step 5 includes the following sub-steps:

[0095] Step 5.1: Select a portion of training samples from the processed domain dataset and record them as D d ;

[0096] Step 5.2: Calculate the Transformer model in D according to the following loss function formula d The loss on , and get its gradient, and use the gradient descent algorithm to update the model parameters:

[0097]

[0098]

[0099] Among them, θ is the parameter of the Transformer model, x is the input sequence, and y <t is the output before time t, and N is the length of the output sequence; Indicates the gradient of the model parameter θ;

[0100] Step 5.3: Repeat steps 5.1 to 5.2 until the training meets the convergence conditions.

[0101] In one embodiment, see Figure 2 , the Transformer model, the Transformer model, is a fragment-level recurrent Transformer model;

[0102] The segment-level recurrent Transformer model includes a Transformer module and a linear layer module;

[0103] The Transformer module is a multi-layer Transformer stack structure that only contains a decoder, including an input layer and a multi-layer sub-Transformer module arranged in series; the input layer is an embedding layer, which is used to convert each received token into a corresponding embedding feature vector; each of the sub-Transformer modules includes, in order, a first layer_norm layer, a self-attention layer, a first residual connection layer, a second layer_norm layer, a fully connected layer, a second residual connection layer and an output layer; the first layer_norm layer is used to perform layer normalization processing on the input; the self-attention layer is used to learn the contextual semantic features of the sentence; the first residual connection layer is used to add the outputs of the first two layers; the second layer_norm layer, which performs layer normalization on the result of the residual connection; the fully connected layer is used to perform a linear transformation on the normalized result; the second residual connection layer is used to add the outputs of the first two layers; the output layer is a fully connected layer, which converts the calculated result into a probability value for each token and outputs the token with the highest probability;

[0104] The linear layer is used to update the [mem] token group of the previous data fragment at the index position and use it as the memory fragment of the next data fragment.

[0105] This embodiment also provides a segment-level recurrent Transformer model training device based on exponential memory enhancement, including:

[0106] one or more processors;

[0107] A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the exponential memory-enhanced fragment-level recurrent Transformer model training method.

[0108] The Transformer model of the present invention introduces an enhanced memory mechanism to expand the capabilities of the traditional Transformer model, enabling it to effectively process long sequence data while maintaining parallel computing.

[0109] The present invention is further described below through specific experiments.

[0110] This experiment collected 90,008 pieces of summary and multi-round dialogue data as the data set of this experiment. The longest data is 10,238, which is divided into training set and test set in a ratio of 7:3. The model used is LLaMA 7b (a type of Transformers model), and the graphics card used in the experiment is a consumer-grade graphics card (GeForce RTX 3090, 24GB video memory). During the experiment, the ordinary LLaMA model and the extended LLaMA model with the introduction of the enhanced memory mechanism are first trained on the training set until the model converges. During the training stage, the ordinary LLaMA model can receive data with a maximum length of 4078. Data exceeding this length will cause the problem of video memory overflow. The extended LLaMA model with the introduction of the enhanced memory mechanism does not have the problem of video memory overflow, and all data can be trained.

[0111] During the testing phase, the ordinary LLaMA model will throw a memory overflow problem when the generation length is 4582, while the extended LLaMA model that introduces the enhanced memory mechanism can continue to generate until the end of the sentence without throwing a memory overflow problem.

[0112] Experiments have shown that the performance is better than or at least comparable to that of traditional Transformers in language modeling and complex tasks, and it is more efficient in memory usage, providing an effective solution for long sequence data processing and long-term dependency learning.

[0113] Experimental results show that the extended Transformer model with enhanced memory mechanism can perform training and reasoning on ultra-long sequences on consumer-grade graphics cards. Compared with the traditional Transformer model and another long-sequence-friendly Transformer-XL model, this method can achieve better results in sequence processing tasks such as copying, retrieval and other memory-intensive tasks, while consuming less memory in language modeling, indicating that the present invention has broad practical significance and commercial value.

[0114] It should be understood that the embodiments described above are part of the embodiments of the present invention, rather than all of the embodiments. In addition, the technical features in the various embodiments or single embodiments provided by the present invention can be combined with each other arbitrarily to form a feasible technical solution. Such combination is not restricted by the sequence of steps and / or the structural composition mode, but must be based on the ability of ordinary technicians in the field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the protection scope required by the present invention.

[0115] It should be understood that the above description of the preferred embodiment is relatively detailed and cannot be regarded as limiting the scope of patent protection of the present invention. Under the enlightenment of the present invention, ordinary technicians in this field can also make substitutions or modifications without departing from the scope of protection of the claims of the present invention, which all fall within the scope of protection of the present invention. The scope of protection requested for the present invention shall be based on the attached claims.

Claims

1. A method for training a segment-level recurrent Transformer model based on exponential memory enhancement, characterized in that: Step 1: Construct a training data set, wherein the data in the training data set includes general text data and partial domain data; Step 2: Perform segmentation processing on the data in the training dataset to obtain input sequence data; Step 3: Add "memory token" to the input sequence data to implement the memory mechanism and obtain the processed general text data and processed domain data; For a given input segment τ, add [mem]token to augment the input. The [mem]token is processed in the same way as other tokens in the sequence. Each [mem]token is a real vector representing the token in each segment. Add m [mem] tokens to the front of At the same time, add m [mem] token representations at the end in, is the initial value, m is the hyperparameter, and N is the number of layers of Transformer; The [mem] token group at the beginning of the segment is for reading memory The sequence tokens of the next segment are allowed to notice the memory state of the previous segment; the [mem] token group at the end of the segment is written to the memory Able to focus on all token representations of the current segment and update the representation stored in memory Step 4: Use the processed general text data to pre-train the Transformer model until the training meets the convergence condition; Step 5: Fine-tune the Transformer model with the processed domain data until the training meets the convergence conditions.

2. The method for training a segment-level recurrent Transformer model based on exponential memory enhancement according to claim 1, characterized in that: The specific implementation of step 1 includes the following sub-steps: Step 1.1: Given a series of prompt-answer text pairs The prompt is denoted by x i , the corresponding answer is denoted as y i ,There are n pairs in the dataset; the prompts contain both general knowledge text data and specific domain knowledge text data; Step 1.2: For the original prompt-answer text pairs, perform data cleaning preprocessing, including deduplication, removal of short texts, deletion of redundant information, and adding "#question:" at the beginning of the prompt text as the start mark of the prompt, and adding "#answer:" at the beginning of the answer text as the start mark of the answer, and adding a line break between the prompt and the answer to distinguish them.

3. The method for training a segment-level recurrent Transformer model based on exponential memory enhancement according to claim 1, characterized in that: In step 2, for each pair of prompt texts in the training dataset (x i ,y i ), they are concatenated into a whole text sequence, and the input text sequence is divided into fixed-size segments in sequence, with a segment length of τ, and the part less than the length of τ is taken as a separate segment.

4. The method for training a segment-level recurrent Transformer model based on exponential memory enhancement according to claim 1, characterized in that: In step 3, the segments of the input sequence data are processed in order. To achieve exponential loop connection between segments, two different operations are performed on the [mem] token group of the previous segment according to the position of the current segment: Operation 1: When the current segment is at the exponential position 2, that is, τ = 2 k ,k=1,2,…,n, then the [mem]token group of the previous segment is updated and used as the memory segment of the current segment: Among them, σ is the activation function, W and b are learnable parameters of the transformer output linear layer parameters; Operation 2: When the current fragment is not at the exponential position of 2, that is, τ≠2 k ,k=1,2,…,n, then directly inherit the [mem]token group of a fragment as the memory fragment of the current fragment:

5. The method for training a segment-level recurrent Transformer model based on exponential memory enhancement according to claim 1, characterized in that: The specific implementation of step 4 includes the following sub-steps: Step 4.1: Select a part of training samples from the processed general text dataset and record it as D g ; Step 4.2: Each sentence in the sequence is used as both the input of the Transformer model and the predicted label. For a sequence s i , the token contained in it is When the training data input is When k As the label of this data, y1,y2,…,y n represents the token at position 1, 2, ..., n, y t represents the token at the tth position, n represents the total length of the sequence, k represents the kth position of the sequence, and y <t is the output before time t; Step 4.3: Calculate the Transformer model in D according to the following loss function formula g The loss on , and get its gradient, and use the gradient descent algorithm to update the Transformer model parameters: Among them, θ is the parameter of the Transformer model, x is the input sequence, N is the output sequence length, Indicates the gradient of the model parameter θ; Step 4.4: Repeat steps 4.1 to 4.3 until the training meets the convergence conditions.

6. The method for training a segment-level recurrent Transformer model based on exponential memory enhancement according to claim 1, characterized in that: The specific implementation of step 5 includes the following sub-steps: Step 5.1: Select a portion of training samples from the processed domain dataset and record them as D d ; Step 5.2: Calculate the Transformer model in D according to the following loss function formula d The loss on , and get its gradient, and use the gradient descent algorithm to update the Transformer model parameters: Among them, θ is the parameter of the Transformer model, x is the input sequence, and y <t is the output before time t, and N is the length of the output sequence; Indicates the gradient of the model parameter θ; Step 5.3: Repeat steps 5.1 to 5.2 until the training meets the convergence conditions.

7. The method for training a segment-level recurrent Transformer model based on exponential memory enhancement according to any one of claims 1 to 6, characterized in that: The Transformer model is a segment-level recurrent Transformer model; The segment-level recurrent Transformer model includes a Transformer module and a linear layer module; The Transformer module is a multi-layer Transformer stack structure that only contains a decoder, including an input layer and a multi-layer sub-Transformer module arranged in series; the input layer is an embedding layer, which is used to convert each received token into a corresponding embedding feature vector; each of the sub-Transformer modules includes, in order, a first layer_norm layer, a self-attention layer, a first residual connection layer, a second layer_norm layer, a fully connected layer, a second residual connection layer and an output layer; the first layer_norm layer is used to perform layer normalization processing on the input; the self-attention layer is used to learn the contextual semantic features of the sentence; the first residual connection layer is used to add the outputs of the first two layers; the second layer_norm layer, which performs layer normalization on the result of the residual connection; the fully connected layer is used to perform a linear transformation on the normalized result; the second residual connection layer is used to add the outputs of the first two layers; the output layer is a fully connected layer, which converts the calculated result into a probability value for each token and outputs the token with the highest probability; The linear layer is used to update the [mem] token group of the previous data fragment at the index position and use it as the memory fragment of the next data fragment.

8. A fragment-level recurrent Transformer model training device based on exponential memory enhancement, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the fragment-level recurrent Transformer model training method based on exponential memory enhancement as described in any one of claims 1 to 7.