Data processing method and data processing device

By employing a multi-slot memory structure and feature extraction dimensionality reduction methods, the problems of gradient vanishing and low efficiency in recurrent neural networks when processing long sequence data are solved, enabling effective learning of long-term dependencies and improving output accuracy.

CN121919674APending Publication Date: 2026-04-24SHENZHEN IDREAMSKY TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN IDREAMSKY TECH
Filing Date
2025-12-10
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing recurrent neural networks and their variants face bottlenecks such as gradient vanishing and inefficiency when processing long sequence data, making it difficult to effectively learn long-term dependencies and process multi-dimensional sequence data.

Method used

A multi-slot memory structure is used to store multiple hidden state vectors in parallel. The original input is compressed by feature extraction and dimensionality reduction. The hidden state is updated in parallel using the multi-slot memory unit. The forgetting parameter is combined to control the degree of information forgetting and generate accurate output.

Benefits of technology

It enhances the memory capacity and long-term dependency learning ability of the data processing device, reduces the amount of computation, and improves the accuracy of the output and the decision-making efficiency of the downstream decision network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121919674A_ABST
    Figure CN121919674A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data processing method and a data processing device, and the data processing device receives the original input of the current time step, firstly performs feature extraction on the original input to obtain a first information block, and achieves the dimension reduction compression of input data, thereby reducing the calculation amount during the subsequent updating of a hidden state. And then, a plurality of different hidden state vectors are stored and updated in parallel by utilizing a multi-slot memory structure, so that the calculation efficiency is improved, the problem of memory confusion encountered when the sequence data is processed by utilizing a traditional sequence model is solved, and the learning ability of the long-term relationship of the long-sequence data is further improved. And finally, generating output by using the plurality of updated hidden state vectors and the first information block, thereby improving the accuracy of the output and further improving the decision efficiency of the downstream decision network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular to a data processing method and a data processing device. Background Technology

[0002] Sequence modeling is a core topic in machine learning and artificial intelligence. Its goal is to process and analyze sequential data with dependencies, such as words and sentences in language, speech signals, video frames, and financial time series. In the early days, recurrent neural networks and their variants, long short-term memory networks and gated recurrent units, became the mainstream methods for handling such tasks through their recurrent connection structures, and initially solved the modeling of short-term dependencies in sequence data.

[0003] However, they still face bottlenecks such as gradient vanishing and inefficiency when processing long sequence data. Summary of the Invention

[0004] Firstly, embodiments of this application provide a data processing method, which can be applied to a data processing device. The data processing method provided in embodiments of this application includes: The first raw input of the sequence model at the first time step is obtained, and then features are extracted from the first raw input to obtain the first information block. The first raw input can be a multi-dimensional vector, and the first information block after feature extraction can also be a multi-dimensional vector, where the dimension of the first information block is lower than the dimension of the first raw input. The first information block can include m sub-information blocks, see [link to documentation]. Figure 4 When the first information block is an m-dimensional vector, each element in the vector can be regarded as a sub-information block of the first information block.

[0005] Then, the hidden state of the memory unit in the sequence model at the second time step is updated using the first information block, thus obtaining the hidden state of the memory unit at the first time step. Here, the second time step is the time step preceding the first time step, and the hidden state at the second time step comprises m hidden state vectors. See also... Figure 5 The sequence model's memory unit can have m memory slots, which can be used to record m hidden state vectors. The m sub-information blocks of the first information block correspond one-to-one with the m hidden state vectors of the second time step. One of the m sub-information blocks of the first information block is used to update the hidden state vector in the m hidden state vectors of the second time step that corresponds to one of the sub-information blocks. m is an integer not less than 1.

[0006] Finally, feature extraction is performed on the hidden states of the first information block and memory unit at the first time step to obtain the output of the sequence model at the first time step.

[0007] Implementing the method provided in the first aspect, we first extract features from the original input to obtain a first information block, achieving dimensionality reduction and compression of the input data, thereby reducing the computational cost of subsequent hidden state updates. Then, we utilize a multi-slot memory structure to store multiple different hidden state vectors in parallel, and use multiple sub-information blocks of the first information block to update multiple hidden state vectors in parallel. This overcomes the memory confusion problem encountered when processing sequential data using traditional sequence models, thus improving the memory capacity of the data processing device and its ability to learn long-term dependencies in long sequence data. Finally, we use the updated multiple hidden state vectors and the first information block to generate the output, improving the accuracy of the output and thus enhancing the decision-making efficiency of the downstream decision network.

[0008] In conjunction with the first aspect, in some embodiments, the method for updating the hidden state may include: multiplying the hidden state of the memory unit at the second time step by a forgetting parameter to obtain the forgotten hidden state, and then generating the hidden state of the memory unit at the first time step based on the forgotten hidden state and the first information block. The forgetting parameter can be understood as a scaling factor, which, by multiplying it by the hidden state of the previous time step, achieves the forgetting of the hidden state of the previous time step. The value of the forgetting parameter is between 0 and 1, used to control the degree of forgetting of the hidden state of the previous time step. Specifically, a larger value of the forgetting parameter indicates a lower degree of forgetting of the hidden state of the previous time step; a smaller value of the forgetting parameter indicates a higher degree of forgetting of the hidden state of the previous time step.

[0009] Implementing the method provided in the above embodiments allows for the rapid forgetting of outdated information when the forgetting parameter value is small, and the long-term retention of key features in the memory slots when the forgetting parameter value is large. By directly adding new information to the forgotten old memory, the memory is updated rapidly, effectively improving the efficiency of data processing.

[0010] In conjunction with the first aspect, in some embodiments, there are m forgetting parameters, each corresponding one-to-one with one of the m hidden state vectors. One of the m forgetting parameters controls the degree of forgetting of the hidden state vector corresponding to that parameter. See also... Figure 7 The m forgotten parameters can include The m hidden state vectors of the second time step can include ,in, Can be with Correspondingly, this is used to control the update of hidden states. The degree of forgetting.

[0011] By implementing the method provided in the above embodiments, the m hidden state vectors stored in the m memory slots of the memory unit can be forgotten to different degrees. By controlling the forgetting parameters, features that need to establish long-term dependencies can be effectively retained, while features that do not need to establish long-term dependencies can be quickly forgotten, thus achieving a balance between long-term memory and short-term memory. This allows for the effective learning of long-term and short-term dependencies in sequence data.

[0012] In conjunction with the first aspect, in some embodiments, the method for updating the hidden state may further include: generating write weights based on the hidden states of the first information block and the second time step. Then, the result of multiplying the first information block by the write weights is added to the hidden state of the memory cell at the first time step to obtain the hidden state of the memory cell at the first time step. The write weights include m values, and each of the m write weights corresponds one-to-one with one of the m hidden state vectors.

[0013] In conjunction with the first aspect, in some embodiments, the first information block can be obtained by feature extraction from the first original input through the following method: the first original input is reduced in dimensionality through a linear layer of a sequence model to obtain a first feature vector; a first gating coefficient is generated based on the first original input; and then, the value of the first feature vector is scaled using the first gating coefficient to generate the first information block.

[0014] By implementing the method provided in the above embodiments, after dimensionality reduction by linear transformation of the original input, the features in the first feature vector can be adjusted by the first gating coefficient to enhance key features and suppress secondary features, thereby filtering out noise or irrelevant information that may remain in the dimensionality reduction process, and further enhancing the information purity and task relevance of the first information block.

[0015] In conjunction with the first aspect, in some embodiments, the method for extracting features from the first information block and the hidden states of the memory unit at the first time step to obtain the output of the sequence model at the first time step may include: calculating the similarity between multiple hidden state vectors of the hidden state of the memory unit at the first time step and a first query vector, and then using one or more hidden state vectors with the highest similarity as the output of the sequence model at the first time step. The first query vector can be any one of the following: the first information block, a linear transformation of the first information block, the first original input, a linear transformation of the first original input, a hidden state vector of the memory unit at the first time step, or a preset query vector.

[0016] In conjunction with the first aspect, in some embodiments, the method for extracting features from the hidden states of the first information block and the memory unit at the first time step to obtain the output of the sequence model at the first time step may further include: determining a first weight and a second weight based on the first information block, and then using the first weight and the second weight to perform a weighted summation of the hidden states of the first information block and the memory unit at the first time step to generate the output of the sequence model at the first time step.

[0017] The first weight can be a second gating coefficient generated based on the first information block, and the second weight can be (1 - the second gating coefficient). The value of the second gating coefficient is between 0 and 1. By using the second gating coefficient to determine the first and second weights, the contribution ratio of memory (i.e., the hidden state of the first time step) and the current input (i.e., the first information block) in the final output can be dynamically balanced. Specifically, when the second gating coefficient approaches 1, the output mainly depends on the historical information in the memory system; when the second gating coefficient approaches 0, the output mainly reflects the input characteristics at the current moment. In this way, the dependence on old and new information can be adaptively adjusted according to the current context.

[0018] Secondly, embodiments of this application provide a data processing apparatus, which includes an input compression unit, a memory unit, and an output retrieval unit. The input compression unit acquires the first raw input of a sequence model at a first time step, and then performs feature extraction on the first raw input to obtain a first information block. The memory unit updates the hidden state of the memory unit in the sequence model at a second time step using the first information block, obtaining the hidden state of the memory unit at the first time step, where the second time step is the time step preceding the first time step. The output retrieval unit generates the output of the sequence model at the first time step using the first information block and the hidden state of the memory unit at the first time step.

[0019] The first information block has a lower dimension than the first original input. The first information block may include m sub-information blocks, see [link to relevant documentation]. Figure 4 When the first information block is an m-dimensional vector, each element in the vector can be regarded as a sub-information block of the first information block.

[0020] The hidden states at the second time step consist of m hidden state vectors. See also Figure 5 The sequence model's memory unit can have m memory slots, which can be used to record m hidden state vectors. The m sub-information blocks of the first information block correspond one-to-one with the m hidden state vectors of the second time step. One of the m sub-information blocks of the first information block is used to update the hidden state vector in the m hidden state vectors of the second time step that corresponds to one of the sub-information blocks. m is an integer not less than 1.

[0021] According to the apparatus provided in the second aspect, the input compression unit, as the preceding working unit of the data processing device, extracts and identifies features from the original input, retains key features, filters out irrelevant information, and transforms the high-dimensional original input into a low-dimensional first information block. This avoids writing redundant or irrelevant information to the memory unit, effectively reduces the amount of data, reduces the computational load of the subsequent working units (i.e., the memory unit and the output retrieval unit) of the data processing device, and thus effectively improves the data processing efficiency of the data processing device.

[0022] The memory unit can store and update multiple hidden state vectors in parallel, without relying on a single hidden state vector. This improves the efficiency and expressive power of the data processing device when handling complex, multi-dimensional inputs, making the data processing device more robust to local noise or outliers in the input.

[0023] Furthermore, the memory unit and output retrieval unit decouple the internal memory of the data processing device from its external output. The memory unit focuses on storing and updating the internal memory, ensuring its purity and enhancing the data processing device's ability to learn long-term dependencies in sequences. The output retrieval unit focuses on retrieving task-relevant information from the internal memory (i.e., hidden states) or new inputs and generating output based on the retrieved information. This ensures that the output only contains information relevant to downstream decisions, thereby reducing the computational complexity of downstream decisions and improving their efficiency and accuracy. It also prevents the leakage of private information unrelated to the output from the internal memory, enhancing security.

[0024] In conjunction with the second aspect, in some embodiments, the method for updating the hidden state of a memory unit may include: multiplying the hidden state of the memory unit at a second time step by a forgetting parameter to obtain a forgotten hidden state, and then generating the hidden state of the memory unit at the first time step based on the forgotten hidden state and the first information block. The forgetting parameter can be understood as a scaling factor, which, by multiplying it by the hidden state of the previous time step, achieves the forgetting of the hidden state of the previous time step. The value of the forgetting parameter is between 0 and 1, used to control the degree of forgetting of the hidden state of the previous time step. Specifically, a larger value of the forgetting parameter indicates a lower degree of forgetting of the hidden state of the previous time step; a smaller value of the forgetting parameter indicates a higher degree of forgetting of the hidden state of the previous time step.

[0025] According to the above embodiments, when the forgetting parameter value is small, it can be used to quickly forget outdated information; when the forgetting parameter value is large, key features can be retained in the memory slot for a long time. By directly adding new information to the forgotten old memory, the memory is updated quickly, effectively improving the efficiency of data processing.

[0026] In conjunction with the second aspect, in some embodiments, there are m forgetting parameters, each corresponding one-to-one with one of the m hidden state vectors. One of the m forgetting parameters controls the degree of forgetting of the hidden state vector corresponding to that parameter. See also... Figure 7 The m forgotten parameters can include The m hidden state vectors of the second time step can include ,in, Can be with Correspondingly, this is used to control the update of hidden states. The degree of forgetting.

[0027] According to the above embodiments, the m hidden state vectors stored in the m memory slots of the memory unit can be forgotten to different degrees. By controlling the forgetting parameters, features that need to establish long-term dependencies can be effectively retained, while features that do not need to establish long-term dependencies can be quickly forgotten, thus achieving a balance between long-term memory and short-term memory. This allows for the effective learning of long-term and short-term dependencies in sequence data.

[0028] In conjunction with the second aspect, in some embodiments, the method for updating the hidden state may further include: generating write weights based on the hidden states of the first information block and the second time step. Then, the result of multiplying the first information block by the write weights is added to the hidden state of the memory cell at the first time step to obtain the hidden state of the memory cell at the first time step. The write weights include m values, and each of the m write weights corresponds one-to-one with one of the m hidden state vectors.

[0029] In conjunction with the second aspect, in some embodiments, the first information block can be obtained by extracting features from the first original input using the following method: the first original input is reduced in dimensionality by a linear layer of a sequence model to obtain a first feature vector; a first gating coefficient is generated based on the first original input; and then, the value of the first feature vector is scaled using the first gating coefficient to generate the first information block.

[0030] According to the above embodiments, after dimensionality reduction by linear transformation of the original input, the features in the first feature vector can be adjusted by the first gating coefficient to enhance key features and suppress secondary features, thereby filtering out noise or irrelevant information that may remain in the dimensionality reduction process, and further enhancing the information purity and task relevance of the first information block.

[0031] In conjunction with the second aspect, in some embodiments, the method for extracting features from the first information block and the hidden states of the memory unit at the first time step to obtain the output of the sequence model at the first time step may include: calculating the similarity between multiple hidden state vectors of the hidden state of the memory unit at the first time step and a first query vector, and then using one or more hidden state vectors with the highest similarity as the output of the sequence model at the first time step. The first query vector can be any one of the following: the first information block, a linear transformation of the first information block, the first original input, a linear transformation of the first original input, a hidden state vector of the memory unit at the first time step, or a preset query vector.

[0032] In conjunction with the second aspect, in some embodiments, the method for extracting features from the hidden states of the first information block and the memory unit at the first time step to obtain the output of the sequence model at the first time step may further include: determining a first weight and a second weight based on the first information block, and then using the first weight and the second weight to perform a weighted summation of the hidden states of the first information block and the memory unit at the first time step to generate the output of the sequence model at the first time step.

[0033] The first weight can be a second gating coefficient generated based on the first information block, and the second weight can be (1 - the second gating coefficient). The value of the second gating coefficient is between 0 and 1. By using the second gating coefficient to determine the first and second weights, the contribution ratio of memory (i.e., the hidden state of the first time step) and the current input (i.e., the first information block) in the final output can be dynamically balanced. Specifically, when the second gating coefficient approaches 1, the output mainly depends on the historical information in the memory system; when the second gating coefficient approaches 0, the output mainly reflects the input characteristics at the current moment. In this way, the dependence on old and new information can be adaptively adjusted according to the current context.

[0034] Thirdly, this application provides a data processing apparatus, including a memory, a processor, and a computer program stored in the memory; the processor executes the computer program to implement the method described in the first aspect and any possible implementation thereof.

[0035] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect and any possible implementation thereof.

[0036] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect and any possible implementation thereof.

[0037] Understandably, the data processing apparatus provided in the third aspect, the computer storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method provided in this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of this application or the background art, the accompanying drawings used in the embodiments of this application or the background art will be described below.

[0039] Figure 1 An example is shown of the memory transfer mechanism in a sequence model; Figure 2 The calculation process of a gated recurrent unit (GRU) is illustrated exemplarily. Figure 3 An exemplary embodiment of the software module of a data processing apparatus provided in this application is shown; Figure 4 An example is shown of the first information block; Figure 5 An example is shown of a multi-slot structure for a multi-slot memory cell; Figure 6 An example is shown of a broadcast operation during the calculation process; Figure 7 An example is shown of a method for updating hidden states based on forgetting parameters; Figure 8 An exemplary illustration shows the flow of the data processing method provided in an embodiment of this application; Figure 9 The hardware structure of a data processing apparatus provided in an embodiment of this application is illustrated by way of example. Detailed Implementation

[0040] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be a limitation of this application.

[0041] To help readers better understand the data processing methods provided in the embodiments of this application, the background technology involved in this application will be introduced below.

[0042] Sequence data is a collection of data arranged in chronological or logical order, reflecting the development process of a certain behavior or event. For example, a speech signal can be viewed as a time series A = {a1, a2, a3, ..., at}, and text can be viewed as a word sequence B = {b1, b2, b3, ..., bn}, and so on. In other words, sequence data includes multiple data points, which can be referred to as different data points in the sequence data. For example, time series A may include t data points, and word sequence B may include n data points. Data points in sequence data typically depend on, or at least are related to, a previous data point. That is, there are dependencies between the various data points in sequence data.

[0043] Sequence models are machine learning models that process sequential data. They understand and predict the dynamic characteristics of a sequence by analyzing the sequential dependencies (such as temporal or logical order) between data points. Specifically, sequence models sequentially receive and process data points in a sequence, capturing the impact of historical information on current data points by maintaining and passing internal states (such as hidden states), thereby modeling the dependencies in the sequence data.

[0044] Sequence models can be applied in deep learning tasks to handle decision problems with time dependencies. They are widely used in fields such as natural language processing, speech recognition, and time series prediction, effectively handling tasks with temporal or contextual relationships, such as text, speech, and sensor data. For example, autonomous vehicles deploy sequence models to make driving decisions based on sensor inputs from cameras, radar, etc.; and they can predict disease progression based on patients' historical physiological data. Common sequence models include Recurrent Neural Networks (RNNs), Long Short-Term Memory (LSTM) networks, and Gated Recurrent Units (GRUs), among others.

[0045] A time step is the basic unit of operation in a sequence model when processing sequential data. It represents the cycle in which the model sequentially processes a data point in the sequence. At each time step, the sequence model receives input, incorporates past memories, updates its memory, and produces output. By advancing through consecutive time steps, the model progressively parses the entire sequence, thereby capturing and utilizing the temporal dependencies within the data.

[0046] The hidden state is the internal state of the sequence model at each time step, used to remember the sequence information received by the model in the past; it can also be called memory. Specifically, the hidden state of the current time step is calculated by combining the current input and the hidden state of the previous time step, recording the sequence information learned by the sequence model up to the current time step. That is, when the sequence model receives a new input x at time step t... t Then based on the input x t And the hidden state h of the model at time step t-1 t-1 Calculate the hidden state h of the model at time step t. t The hidden state is dynamically updated as time steps progress and passed to the next time step, forming a memory transfer mechanism to capture temporal dependencies in the sequence.

[0047] Figure 1 An example is shown of the memory transfer mechanism in a sequence model.

[0048] like Figure 1 As shown, initially, the sequence model can have an initial hidden state h0. Then, the sequence model processes each data point in the sequence sequentially, and at each time step, it generates a new hidden state based on the acquired input and the hidden state from the previous time step, and passes the generated new hidden state to the next time step. Specifically, the sequence model receives input at time step t-1. Then according to Update hidden state A new hidden state is obtained. and the new hidden state The input is passed to time step t. At time step t, the sequence model receives the input. Then according to Update hidden state A new hidden state is obtained. and the new hidden state The input is passed to time step t+1. At time step t+1, the sequence model receives the input. Then according to Update hidden state A new hidden state is obtained. .

[0049] For example, in natural language processing, sequence models can be used to understand a piece of text, such as "I love you". In this case, the input x1 received by the sequence model at time step 1 can be "I", the input x2 received at time step 2 can be "love", and the input x3 received at time step 3 can be "you". The processing of this text by the sequence model can include: obtaining the input "I" at time step 1, and calculating the hidden state h1 of time step 1 based on "I" and the initial hidden state h0, where h1 contains the information of "I"; obtaining the input "love" at time step 2, and calculating the hidden state h2 of time step 2 based on "love" and the hidden state h1, where h2 contains the information of "I love"; obtaining the input "you" at time step 3, and calculating the hidden state h3 of time step 3 based on "you" and the hidden state h2, where h3 contains the information of "I love you".

[0050] Long sequence data refers to sequential data containing a long time span or a large number of consecutive data points. Its significant characteristic is the existence of complex and long-range temporal dependencies between data points, i.e., long-term dependencies. GRU, as a variant of RNN and a simplified version of LSTM, can be used to learn long-term dependencies in long sequence data.

[0051] The Gated Recurrent Unit (GRU) selectively controls the transmission and forgetting of historical information by introducing two gating mechanisms, thereby learning long-term dependencies in long sequence data.

[0052] Figure 2 The calculation process of the gated recurrent unit (GRU) is illustrated as an example.

[0053] like Figure 2 As shown, the Gated Cyclic Unit (GRU) includes two gating units: an update gate and a reset gate. The GRU operates at each time step... Updating the hidden state can include the following steps: Step 1: Calculate the output of the reset gate.

[0054] The reset gate controls how much information from the hidden state of the previous time step needs to be forgotten in order to compute the candidate hidden state for the current time step. The reset gate receives the input from the current time step. The hidden state of the previous time step After concatenating the two, a sigmoid function is used to calculate a vector with values ​​in the interval (0, 1), which can be denoted as... The calculation formula can be found in the following formula: ; in, It is the sigmoid function. It is the learnable weight matrix of the reset gate. It resets the door's bias.

[0055] Step 2: Calculate the candidate hidden states.

[0056] Based on the output of the reset gate The hidden state of the previous time step and the input of the current time step The candidate hidden states are calculated. The candidate hidden states are obtained through the hyperbolic tangent function (…). The function generates a vector whose values ​​are in the interval (-1, 1), which can be denoted as The calculation formula can be found in the following formula: ; in, It is a learnable weight matrix used to compute candidate hidden states. It is the bias term used to calculate the candidate hidden states. This indicates element-wise multiplication.

[0057] As can be seen from the above formula, when the output of the reset door... When the value approaches 0, most of the information from the hidden state of the previous time step will be forgotten; when the output of the gate is reset... When the value approaches 1, it means that most of the information of the hidden state in the previous time step will be retained in the candidate hidden state.

[0058] Step 3: Calculate the output of the update gate.

[0059] The update gate controls how much information from the hidden state of the previous time step needs to be retained in the hidden state of the current time step, and how much new information from the current time step needs to be adopted. The update gate receives input from the current time step. The hidden state of the previous time step A vector whose values ​​are in the interval (0, 1) can be calculated using a sigmoid function and can be denoted as The calculation formula can be found in the following formula: ; in, It is the learnable weight matrix of the update gate. It is the bias term for updating the gate.

[0060] Step 4: Update the hidden state.

[0061] Specifically, the output of the gate will be updated. As a weight, the weighted average of the candidate hidden state and the hidden state at the previous time step is calculated to obtain the hidden state at the current time step, thereby realizing the update of the hidden state. The calculation formula can be found in the following formula: ; in, This indicates element-wise multiplication.

[0062] As can be seen from the above formula, the new hidden state have The information comes from the hidden state of the previous time step. ,have Information comes from candidate hidden states .when When it approaches 0, almost all new hidden states They all originate from the hidden state of the previous time step. ;when When the value approaches 1, almost all new hidden states... All come from candidate hidden states .

[0063] However, the gated recurrent unit (GRU) still has the following problems when processing sequence data: Firstly, the gated recurrent unit (GRU) includes multiple weight matrices (such as...) during the calculation of updating the hidden state. , , ) and bias terms (such as , , The large number of parameters in the GRU results in a high computational cost. Furthermore, the GRU's hidden state update process involves multiple nonlinear operations. For example, calculating the output of the reset gate in step 1 and the output of the update gate in step 3 both require the sigomid activation function, and calculating the candidate hidden state in step 2 requires the tanh activation function. The exponential operations involved in these activation functions significantly increase the computational cost, leading to the GRU consuming substantial computational resources when updating hidden states. This also results in lower training efficiency and inference speed for the model.

[0064] Secondly, the hidden states in the gated recurrent unit (GRU) are represented by a single vector, h. tThe hidden state is represented by a single vector. In other words, the Gated Recurrent Unit (GRU) indiscriminately combines information from the sequence data linearly and fills it into the same vector, blurring the boundaries between information with different physical meanings and statistical properties. For example, information from a sequence of environmental data containing different types of environmental data (such as wind data, temperature data, etc.) is indiscriminately filled into a single vector. This method of using a single vector to represent the hidden state results in all different types of information being chaotically mixed together, forming a high-dimensional hidden state vector. This makes it impossible for the model to independently process a specific type of information when updating the hidden state, and it is also difficult to extract a specific type of information from the hidden state. Consequently, the GRU performs poorly when processing sequence data containing multi-dimensional data.

[0065] Thirdly, in deep learning networks, the decision network downstream of the sequence model makes decisions based on the output of the sequence model. However, the Gated Recurrent Unit (GRU) does not have a separate output gate; the hidden state serves as both internal memory and external output. This coupled design leads to performance defects in the model: on the one hand, in order to generate effective output, the hidden state is forced to contain information not needed for long-term memory, thus preventing the model from accurately learning long-term dependencies in the sequence data; on the other hand, to maintain the integrity of long-term memory, the hidden state retains information not needed for the current output, meaning the output contains a lot of redundant information. This prevents the model from accurately outputting according to task requirements, making it difficult for the downstream decision network to flexibly extract and integrate information when generating decisions based on the output, thereby limiting the decision-making efficiency and capability of the downstream decision network.

[0066] To address this, embodiments of this application provide a data processing method and a data processing apparatus. After receiving the raw input at the current time step, the data processing apparatus first extracts features from the raw input to obtain a first information block, achieving dimensionality reduction and compression of the input data, thereby reducing the computational load when updating the hidden states. Then, a multi-slot memory structure is used to store and update multiple different hidden state vectors in parallel, overcoming the memory confusion problem encountered when processing sequence data using traditional sequence models, thus improving the memory capacity of the data processing apparatus 100 and its ability to learn long-term dependencies in long sequence data. Finally, the updated multiple hidden state vectors and the first information block are used to generate an output, improving the accuracy of the output and thus enhancing the decision-making efficiency of the downstream decision network.

[0067] Figure 3 An exemplary embodiment of the software module of a data processing apparatus provided in this application is shown.

[0068] like Figure 3As shown, the data processing device 100 may include three working units: an input compression unit 101, a multi-slot memory unit 102, and an output retrieval unit 103. These three working units cooperate to implement the following data processing method: First, the input compression unit 101 receives the original input of the sequence at the current time step and performs feature extraction on the original input to obtain a dimension-reduced information block; then, the multi-slot memory unit 102 obtains the hidden state of the current time step based on the dimension-reduced information block and the hidden state of the previous time step, thus updating the hidden state; finally, the output retrieval unit 103 extracts key information from the dimension-reduced information block and the hidden state of the current time step, and calculates the output of the current time step based on this key information.

[0069] The following section will introduce each work unit in detail.

[0070] First, let's introduce the input compression unit 101.

[0071] The input compression unit 101 can be used to receive the original input of the sequence at the current time step, and then perform feature extraction on the original input to obtain multiple information blocks. In this embodiment, this process of obtaining information blocks from the original input can also be called chunking.

[0072] Specifically, the raw input contains a large amount of redundancy, noise, and task-irrelevant details. The input compression unit 101 can identify key features in the raw input, extract these key features from the raw input, and then organize these key features into structured information chunks.

[0073] In this embodiment of the application, the original input of the sequence at time step t It can be a multi-dimensional vector. The specific content of this multi-dimensional vector can depend on the type of sequence being processed. For example, when the sequence is a video sequence, the original input... It can be a multidimensional vector containing all pixel values ​​of a video frame; when the sequence is a speech sequence, the original input... It can be a multidimensional vector containing original waveform sampling points of a speech segment; when the sequence is a game data sequence, the original input... It can be a multi-dimensional vector that includes various types of game data (such as player coordinates, health points, item status, etc.), and so on.

[0074] For example, the original input It can be a k-dimensional vector. For example, the original input vector. Original input vector The j-th data element in can be denoted as j is an integer greater than or equal to 1 and less than or equal to k. For example, when the sequence is a video sequence, the data elements... It can be used to represent a pixel value of a video frame; when the sequence is a speech sequence, the original input vector A data element It can be used to represent a sample point of a speech segment; when the sequence is a game data sequence, the original input vector A data element It can be used to represent a game environment parameter, etc.

[0075] In this embodiment, an information block refers to a key feature extracted from the original input by the input compression unit 101. Multiple information blocks obtained after feature extraction can constitute a single overall information block, which can then be referred to as the first information block. That is, the input compression unit 101 obtains the first information block by performing feature extraction on the original input. The first information block includes multiple sub-information blocks, each of which is a one-dimensional feature extracted from the original input.

[0076] In this embodiment of the application, the first information block can be represented as a multi-dimensional vector. For example, the first information block can be represented as an m-dimensional vector, denoted as . .

[0077] Figure 4 An example of the first information block is shown.

[0078] like Figure 4 As shown, the mathematical expression for the first information block can be: .in, Each data element is a sub-information block of the first information block, and also a one-dimensional feature extracted from the original input. For example, Information block 1 is a component of the first information block. For information block 2, ..., which is a sub-information block of the first information block. This is an information block m that is part of the first information block.

[0079] In this embodiment, a first information block is obtained by extracting features from the original input. The dimension of the first information block is lower than the dimension of the original input, and the data volume of the first information block is also smaller than the data volume of the original input. Specifically, the first information block is an m-dimensional vector, and the original input is a k-dimensional vector. The dimension of the first information block is lower than the dimension of the original input, that is, m is less than k.

[0080] The raw input typically contains a large amount of redundancy, noise, and task-irrelevant details, and direct processing of these can lead to low computational efficiency of the data processing device 100. The input compression unit 101, as a preceding working unit of the data processing device 100, extracts and identifies features from the raw input, retains key features, filters out irrelevant information, and transforms the high-dimensional raw input into a low-dimensional first information block. This avoids writing redundant or irrelevant information to the multi-slot memory unit, effectively reducing the amount of data and the computational load of the subsequent working units of the data processing device 100 (i.e., the multi-slot memory unit 102 and the output retrieval unit 103), thereby effectively improving the data processing efficiency of the data processing device 100.

[0081] This application provides two different chunking methods: gating-based chunking and attention-based chunking. As mentioned above, the original input is a multi-dimensional vector, and the first information chunk is a multi-dimensional vector with a dimension lower than that of the original input. The following example, where the original input is a k-dimensional vector and the first information chunk is an m-dimensional vector (where m is less than k), will be used to elaborate on the two chunking methods provided in this application: 1) Gating-based modularization In some implementations, the input compression unit 101 may first reduce the dimensionality of the original input through a linear layer to obtain a first feature vector. Then, it generates a first gating coefficient based on the original input and uses the first gating coefficient to gating the first feature vector, thereby generating a first information block.

[0082] Linear layers, also known as fully connected layers, are one of the fundamental components of neural networks. They can perform dimensionality transformation, feature combination, and representation learning on input information and are commonly used for feature extraction in deep learning tasks. Specifically, a linear layer can perform a linear transformation (i.e., matrix multiplication) on the input vector using a learnable weight matrix. The formula can be expressed as output = input × weight matrix, thereby achieving an arbitrary linear spatial mapping from input features to output features. A learnable weight matrix means that the values ​​of these weight matrices are not fixed values ​​preset by humans, but are automatically adjusted and optimized by the model during training using the gradient descent algorithm. In this embodiment, the input compression unit 101 can perform a linear transformation on the original input using a learnable first weight matrix to achieve dimensionality reduction and obtain a first feature vector.

[0083] Gating coefficients are weight parameters used in neural networks to control information transmission, determining which information should be retained and which should be forgotten, thus enabling the model to more effectively handle sequential data and long-term dependency issues. In this embodiment, after dimensionality reduction through linear transformation of the original input, the features in the first feature vector can be adjusted using the first gating coefficient to enhance key features and suppress secondary features, thereby filtering out noise or irrelevant information that may remain during the dimensionality reduction process, further enhancing the information purity and task relevance of the first information block.

[0084] In some implementations, the first gating coefficient can be generated based on the original input. This allows the input compression unit 101 to dynamically and adaptively generate different first gating coefficients based on different original inputs. Specifically, the original input is first linearly transformed using a learnable second weight matrix, then normalized using a sigmoid activation function, ultimately generating a gating coefficient vector with the same dimension as the first feature vector. The generated gating coefficient vector is used for element-wise multiplication with the first feature vector to obtain the first information block. That is, the data element at position i in the gating coefficient vector is multiplied by the data element at the same position i in the first feature vector, and the formula can be expressed as: First Information Block = First Gating Coefficient Vector ⊙ First Feature Vector.

[0085] Specifically, the method for chunking the original input based on gating can be referenced by the following formula: ; in, This represents the first learnable weight matrix, used to perform a linear transformation on the original input to achieve dimensionality reduction. This represents the learnable second weight matrix, used to generate the first gating coefficients from the original input.

[0086] For example, when the original input When it is a k-dimensional vector, It can be an m×k dimensional matrix used to process the original input. Perform a linear transformation to extract m-dimensional features, resulting in an m-dimensional feature vector. That is, the first eigenvector. It can also be an m×k dimensional matrix used for the original input. After performing a linear transformation, a sigmoid function is used to generate an m-dimensional gating coefficient vector with values ​​in the range (0,1). , which is the first gating coefficient. Wherein, the gating coefficient vector... The m data elements are used to adjust the first feature vector. The output intensity of the m-dimensional features. Finally, the first feature vector. with gate coefficient vector Element-wise multiplication generates an m×1 dimensional first information block. .

[0087] 2) Self-attention-based chunking In some implementations, the input compression unit 101 can chunk the original input based on a self-attention mechanism to obtain a first information block. The main content of this method may include: calculating the correlation weights between k-dimensional features within the original input vector, and weighting and aggregating the k-dimensional features of the original input based on these correlation weights to ultimately generate an m-dimensional first information block.

[0088] Specifically, a chunking method based on self-attention mechanisms may include the following steps: Step 1: Increase the dimensionality of the original input vector through a linear layer to obtain the input matrix a.

[0089] Specifically, the original k-dimensional input vector can be dimension-upgraded to [k, 1], and then multiplied by a weight 'a' to obtain the input matrix 'a'. Here, the weight 'a' has a shape of [1, embedded_dim], and the input matrix 'a' has a shape of [k, embedded_dim]. In some implementations, the weight 'a' can be a learnable weight vector.

[0090] The input to a self-attention mechanism is a sequence, where each element is a vector. The original input is projected into a feature space suitable for the self-attention mechanism by increasing its dimensionality.

[0091] Step 2: Perform feature learning on the input matrix a through a self-attention layer to obtain the feature matrix b.

[0092] Specifically, the input matrix a is first subjected to three different linear transformations to obtain the query, key, and value. These three different linear transformations can be achieved using three different weight matrices. Then, attention weights are obtained based on the query and key, and these attention weights are multiplied by the value to obtain the output of the self-attention layer, i.e., the feature matrix b. The feature matrix b has the shape [k, embedded_dim].

[0093] In some implementations, the three weight matrices used to perform a linear transformation on the input matrix a can be learnable weight matrices.

[0094] Step 3: Generate slot coefficient matrix c based on feature matrix b.

[0095] Step 4: Generate the first information block based on the slot coefficient matrix c.

[0096] Specifically, the feature matrix b is multiplied by a weight matrix b to obtain the slot coefficient matrix c. The weight matrix b has a shape of [embeded_dim, m], and the slot coefficient matrix c has a shape of [k, m]. Then, the shape of the slot coefficient matrix c is transformed to [m, k] by transposing it, and then multiplied by the original input whose shape has been transformed to [k, 1] to obtain the first information block.

[0097] In this matrix, the sum of the elements in each row of the slot coefficient matrix c is 1, which represents the proportion of each dimension of the original input k-dimensional features allocated to the m features of the first information block (i.e., the m memory slots in the following text).

[0098] The multi-slot memory unit 102 is described below.

[0099] The multi-slot memory unit 102 can be used to store and update the hidden state.

[0100] Unlike existing technologies that use a single vector to represent the hidden state, in this embodiment, the multi-slot memory unit stores the hidden state through a multi-slot structure.

[0101] Figure 5 An example of a multi-slot structure for a multi-slot memory cell is shown.

[0102] like Figure 5 As shown, the multi-slot memory unit 102 may include multiple memory slots, such as memory slot 1, memory slot 2, ..., memory slot m. Each memory slot can be considered an independent memory unit, used to store an independent hidden state vector. That is, the hidden state of the multi-slot memory unit 102... It can include multiple hidden state vectors, whose mathematical expression can be: .in, This represents the hidden state vector of the j-th memory slot at time step t. Specifically, Stored in memory slot 1, Stored in memory slot 2, ... The hidden state vector is stored in memory slot m. In some embodiments, the hidden state vector of each memory slot of the multi-slot memory unit 102 has the same dimension. For example, the hidden state vector of each memory slot of the multi-slot memory unit 102 can be a c-dimensional vector, where the hidden state vector of the j-th memory slot can represent... ,in, Represents the hidden state vector The i-th data element in the dataset. Specifically, , ,..., At this point, the hidden state of the multi-slot memory unit 102 can be specifically represented as a matrix containing multiple hidden state vectors; that is, the multi-slot memory unit 102 stores a hidden state matrix. When the multi-slot memory unit 102 includes m memory slots, and the hidden state vector of each memory slot is a c-dimensional vector, the hidden state matrix of the multi-slot memory unit 102 is... The dimension can be m×c.

[0103] It should be noted that the memory slot mentioned in the embodiments of this application is an abstract, logical memory unit, which corresponds to an independent hidden state vector in the hidden state matrix. It is used to figuratively express the data organization form of the hidden state, and does not refer to a physical, hardware storage slot. In essence, it is a continuous or non-contiguous storage space in computer memory used to store an independent hidden state vector.

[0104] In some implementations, the multiple memory slots of the multi-slot memory unit 102 can be used to store different latent state information, such as different dimensions, different themes, different types, etc. For example, in a complex game scene, memory slot 1 can be dedicated to storing and updating information related to spatial location, memory slot 2 can be dedicated to storing and updating information related to mission objectives, memory slot 3 can be dedicated to storing and updating information related to opponent dynamics, and so on. This multi-slot structure of the multi-slot memory unit 102 can support the data processing device 100 in extracting a single latent state vector from the overall latent state and processing it independently. For example, only the latent state vector of the memory slot dedicated to storing the opponent's state can be extracted and processed independently.

[0105] In this embodiment, the method for updating the hidden state of the multi-slot memory unit 102 at time step t may include: the multi-slot memory unit 102 may receive a first information block from the input compression unit 101. Then, using the first information block Update the hidden state of multi-slot memory unit 102 at time step t-1. Obtain the hidden state of the multi-slot memory unit 102 at time step t. .

[0106] In this embodiment, the multi-slot structure of the multi-slot memory unit 102 can be matched with the dimension of the first information block output by the input compression unit 101. That is, the first information block... The dimension is the same as the number of memory slots in the multi-slot memory unit 102 (i.e., the number of hidden state vectors). For example, the first information block is an m-dimensional vector, and the number of memory slots in the multi-slot memory unit 102 is also m.

[0107] Based on the matching relationship between the dimension of the first information block and the number of memory slots in the multi-slot memory unit 102, in some embodiments, multiple memory slots in the multi-slot memory unit 102 can have a one-to-one correspondence with multiple sub-information blocks of the first information block. That is, the j-th memory slot in the multi-slot memory unit can correspond to the j-th sub-information block in the first information block, and is used to receive and process the j-th sub-information block in the first information block. In other words, the hidden state vector of the j-th memory slot is used to record the information of the j-th sub-information block in the first information block. Furthermore, at time step t, the j-th sub-information block in the first information block can be used to update the hidden state vector stored in the j-th memory slot. To obtain the hidden state vector of the j-th memory slot at time step t. .

[0108] Based on the above design of the multi-slot structure of the multi-slot memory unit, the multi-slot memory unit can store and update multiple hidden state vectors in parallel without relying on a single hidden state vector, thereby improving the efficiency and expressive power of the data processing device 100 when processing complex and multi-dimensional inputs, and making the data processing device 100 more robust to local noise or outliers in the input.

[0109] This application provides three different methods for updating hidden states: updates based on forgetting parameters, updates based on attention, and updates based on gated recurrent units. These are described in detail below: 1) Update based on forgetting parameters In the update method based on forgetting parameters, the hidden state of the multi-slot memory unit 102 in the previous time step can be updated first according to the forgetting parameters. The process involves forgetting information and then generating the hidden state of the multi-slot memory unit 102 at the current time step based on the first information block and the hidden state after forgetting.

[0110] In this embodiment, the forgetting parameter can be understood as a scaling factor, which is multiplied by the hidden state of the previous time step to achieve the forgetting of the hidden state of the previous time step. The value of the forgetting parameter is between 0 and 1, used to control the degree of forgetting of the hidden state of the previous time step. Specifically, the larger the value of the forgetting parameter, the lower the degree of forgetting of the hidden state of the previous time step; the smaller the value of the forgetting parameter, the higher the degree of forgetting of the hidden state of the previous time step. A lower degree of forgetting means that more hidden state information from the previous time step is retained in the current time step, while a higher degree of forgetting means that more hidden state information from the previous time step is discarded. For example, when the forgetting parameter approaches 1, almost all the hidden state information from the previous time step is retained in the next time step; when the value of the forgetting parameter approaches 0, almost all the hidden state information from the previous time step is discarded. When the forgetting parameter value is small, it can be used to quickly forget outdated information; when the forgetting parameter value is large, key features can be retained in the memory slot for a long time. In this way, by training and learning to adjust the forgetting parameters, we can effectively learn both long-term and short-term dependencies in sequence data.

[0111] Specifically, the multi-slot memory unit 102 can be in the hidden state of the previous time step. Multiply by the forgetting parameter, and then combine the result with the first information block. Add them together to obtain the hidden state at time step t. The specific calculation process can be found in the following formula: ; in, Indicates the forgotten parameter, This indicates element-wise multiplication.

[0112] It should be noted that in the embodiments of this application, when the data dimensions do not match during the process of updating the hidden state using the above formula, the calculation can be completed through a broadcast operation.

[0113] Figure 6 An example is shown of a broadcast operation during the computation process.

[0114] like Figure 6 As shown, Given an m-dimensional vector, Given an m×c dimensional matrix, It is also an m×c dimensional matrix. and The dimensions do not match, so they cannot be directly added. In this embodiment, the dimensions can be first... Expand to a with An m×c dimensional matrix X that matches the dimensions of the given matrix. Matrix X can contain c identical m-dimensional column vectors. Then combine matrix X with... Add element by element. This can also be understood as first adding... Transform it into an m-dimensional column vector, and then... Add up each column in the first information block. That is, add up the j-th sub-information block from the first information block. Each of the c forgotten data elements in the j-th memory slot is respectively associated with The addition process is as follows:

[0115] Figure 7 An example is shown of a method for updating hidden states based on forgetting parameters.

[0116] See Figure 7 In some implementations, there are m forgetting parameters, each corresponding one-to-one with one of the m hidden state vectors in the hidden state. One of the m forgetting parameters controls the degree of forgetting of the hidden state vector corresponding to that parameter. In other words, the hidden state vector of each memory slot can be forgotten to varying degrees, and then added to the corresponding sub-information block in the first information block to update the hidden state vector of the memory slot.

[0117] at this time, It can be an m-dimensional vector, i.e. Each data element This is used to control the degree of forgetting of the hidden state vector of a memory slot, i.e. This is used to control the degree of forgetting of the hidden state vector of memory slot j, in order to achieve higher computational efficiency on tasks that do not require modeling long-term dependencies. The update formula for the hidden state vector of memory slot j at time step t can be: Specifically, , ,..., .

[0118] In other implementations, not only can different degrees of forgetting be applied to each memory slot, but different degrees of forgetting can also be applied to each piece of information within each memory slot. That is, different degrees of forgetting are applied to each data element in the hidden state matrix to provide finer-grained control over the forgetting rate of each slot and each feature. In this case, It can be an m×c dimensional matrix that matches the dimension of the hidden state matrix, or a combination of an m×1 dimensional vector and a 1×c dimensional vector.

[0119] when When the hidden state matrix is ​​an m×c dimensional matrix matching its dimension, the update formula for the i-th data element in memory slot j can be: ; when When a vector of length m×1 is combined with a vector of length 1×c, the m values ​​in the m×1 vector are used to control the degree of forgetting of the m different memory slots, and the c values ​​in the 1×c vector are used to control the degree of forgetting of the c different pieces of information in each memory slot.

[0120] 2) Attention-based updates Specifically, at time step t, the similarity between the first information block and the hidden state vectors of each memory slot is first calculated using a similarity algorithm. Based on the calculated similarity, a write weight corresponding to each memory slot is generated. The write weight of each memory slot is proportional to the similarity between the hidden state vector of that memory slot and the first information block. Then, the hidden state vectors of each memory slot are updated to different degrees according to these write weights. The write weight of each memory slot controls the degree to which the first information block is written into the hidden state vectors of each memory slot. When the write weight corresponding to memory slot j approaches 1, the first information block is almost completely written into the hidden state vector of memory slot j; when the write weight corresponding to memory slot j approaches 0, the hidden state vector of memory slot j remains almost unchanged.

[0121] Specifically, attention-based update methods may include the following steps: Step 1: After the first information block is upgraded in dimension, a linear transformation is performed to obtain the key and value. The shape of both the key and the value is [m, c].

[0122] Step 2: Change the hidden state from the previous time step. The query is used as the query, and then the attention weight is calculated based on the query and the key.

[0123] Step 3: Multiply the attention weights calculated in Step 2 by the value Value to obtain the update matrix d. The shape of the attention weights is [m, c], and each row of weight parameters can be regarded as the write weight corresponding to each memory slot.

[0124] Step 4: Compare the update matrix d with the hidden state of the previous time step. Adding them together gives the hidden state at the current time step. .

[0125] 3) Independent slot update based on gated loop unit Specifically, each memory slot can correspond to an independent gated loop unit. When the multi-slot memory unit 102 has m memory slots, it can have m gated loop units. These m gated loop units can be used to update the hidden state vectors of the m memory slots, thereby updating the hidden state matrix of the multi-slot memory unit 102.

[0126] In some implementations, at each time step t, each gated loop unit can receive a first information block and, based on the first information block and the hidden state vector of the memory slot corresponding to that gated loop unit in the previous time step, update the hidden state vector through the hidden state update mechanism of the gated loop unit to obtain the hidden state vector of the memory slot in the current time step t. For example, at time step t, the gated loop unit j corresponding to memory slot j can receive the first information block, and then the gated loop unit j updates the hidden state vector corresponding to memory slot j based on the first information block.

[0127] In other implementations, at each time step t, each gated loop unit can receive a sub-information block from the first information block corresponding to the memory slot of that gated loop unit. Then, based on this sub-information block and the hidden state vector of the memory slot corresponding to that gated loop unit in the previous time step, the hidden state vector is updated through the hidden state update mechanism of the gated loop unit to obtain the hidden state vector of the memory slot at the current time step t. For example, the sub-information block corresponding to memory slot j in the first information block is information block j, and the gated loop unit corresponding to memory slot j is gated loop unit j. At time step t, gated loop unit j can receive information block j from the first information block, and then gated loop unit j updates the hidden state vector corresponding to memory slot j based on information block j.

[0128] The output retrieval unit 103 is described below.

[0129] like Figure 3 As shown, the output retrieval unit 103 is used to receive the first information block from the input compression unit 101. and the hidden state from the multi-slot memory unit 102 at the current time step t Then from the first information block and hidden state The system filters out information relevant to the task requirements and generates the output for the current time step t based on the filtered information. .

[0130] Here, task requirements refer to the output requirements of the reinforcement learning task when the data processing device 100 is processing a specific reinforcement learning task. Task requirements are implicit requirements, which can be specifically understood as the requirement for the output retrieval unit 103 to make a decision output that maximizes the accumulated reward during the training process.

[0131] In deep learning networks, the data processing device 100 may further include downstream networks for decision-making, such as policy networks, value networks, etc. The output of the output retrieval unit 103 is also included. It can be further fed into downstream networks within a deep learning network, so that the downstream networks can... The final decision is generated. The downstream network is a module that follows the data processing device 100, receives its output, and completes the operations related to the final decision.

[0132] In this embodiment of the application, the output of the retrieval unit 103 is... It can be a multi-dimensional feature vector. This multi-dimensional feature vector can include key features related to decision-making in downstream networks, such as policy generation and value evaluation. For example, the downstream policy network can receive... Then according to Multidimensional feature generation and interaction with the environment.

[0133] Specifically, during the training phase, the output retrieval unit 103 can continuously adjust its learnable parameters based on the target output in the training samples through the backpropagation algorithm until the output retrieval unit 103 can generate the target output or an output close to the target output, thereby learning how to extract information from the first information block and the hidden state of the current time step and generate an output that meets the needs of downstream decision-making.

[0134] In the actual use phase after training, the trained output retrieval unit 103 can extract the information required for downstream decision-making from the first information block and the hidden state of the current time step, thereby improving the task relevance of the output information and the decision-making efficiency.

[0135] In this embodiment, the multi-slot memory unit 102 and the output retrieval unit 103 decouple the internal memory of the data processing device 100 from its external output. The multi-slot memory unit 102 focuses on storing and updating the internal memory, ensuring its purity and improving the data processing device 100's ability to learn long-term dependencies in sequences. The output retrieval unit 103 focuses on retrieving task-related information from the internal memory (i.e., hidden state) or new inputs and generating output based on the retrieved information. This ensures that the output only contains information relevant to downstream decisions, thereby reducing the computational complexity of downstream decisions, improving decision efficiency and accuracy, and also preventing the leakage of privacy information unrelated to the output from the internal memory, thus enhancing security.

[0136] This application provides three different methods for retrieving information from input (i.e., the first information chunk) and memory (i.e., the hidden state) and generating output, including gating-based retrieval output, cross-attention-based retrieval output, and maximum similarity-based retrieval output. These are elaborated below: 1) Gated retrieval output In some implementations, the output retrieval unit 103 may first generate a first weight and a second weight based on the first information block, and then use the first weight and the second weight to perform a weighted summation of the first information block and the hidden state of the current time step to generate the output of the current time step. The first weight may correspond to the hidden state of the current time step, and the second weight may correspond to the first information block.

[0137] Specifically, the output retrieval unit 103 can generate a second gating coefficient based on the first information block, and use the second gating coefficient as the first weight and (1-second gating coefficient) as the second weight.

[0138] The second gating coefficient, ranging from 0 to 1, dynamically balances the contribution of historical memory and current input to the final output. When the second gating coefficient approaches 1, the output primarily relies on historical information from the memory system; when it approaches 0, the output mainly reflects the input characteristics at the current moment. This gating mechanism enables the output retrieval unit 103 to adaptively adjust its dependence on both new and old information based on the current context, thereby optimizing output quality.

[0139] The gating-based retrieval output method can be implemented using the following formula: ; This formula can include two parts. The left side is used to exit the hidden state. Searching for information in China ,and The right side is used to extract information from the first information block. Searching for information in China .in, , and It is a learnable weight matrix. This represents the second gating coefficient, i.e., the first weight. It is the second weight.

[0140] Specifically, Used to perform a linear transformation on the first information block and generate the second gating coefficient. It can be a c-dimensional vector, along with the first information block. Multiplying them yields an m×c matrix. Then, passing it through a sigmoid activation function results in an m×c matrix with values ​​in the range (0,1). That is, the second gating coefficient. As a gating coefficient matrix, it is used to control the transition from the hidden state. The amount of information retrieved from the first information block The amount of information retrieved from the hidden state. Specifically, from the hidden state... The amount of information retrieved can be From the first information block The amount of information retrieved can be ( .

[0141] It can be an m×c matrix used for the hidden state matrix. Perform dimension-invariant feature transformation. Then, through... The hidden state matrix after eigenvalue transformation Regularization is performed to prevent the model from expanding during training and causing overfitting, thereby enabling the model to train stably and improve its generalization ability.

[0142] It is a c-dimensional vector used to represent the first information block. We perform dimensionality increase processing, transforming it into an m×c matrix to match the dimension of the hidden state matrix. That is, It is an m×c matrix whose dimensions match the dimensions of the hidden state matrix.

[0143] Finally, from the hidden state Information retrieved from China With the first information block Information retrieved from China Add them together to get the output of the current time step. .

[0144] 2) Retrieval output based on cross-attention Cross-attention is a mechanism that uses one sequence (query sequence) to retrieve relevant information from another sequence (key-value sequence). In this mechanism, the query comes from one information source, while the keys and values ​​come from another. By calculating the similarity between the query and all keys and generating attention weights, information can be dynamically and selectively aggregated from the value sequence, thereby achieving the association and fusion of information from different sources or different contexts.

[0145] In some implementations, the output can be calculated based on cross-attention. Specifically, the retrieval output based on cross-attention may include the following steps: Step 1: Increase the dimensionality of the first information block to obtain the query. The first information block is an m-dimensional vector, and the query has the shape [m, c].

[0146] In some implementations, the method for increasing the dimensionality of the first information block can be: to obtain the query by linearly transforming the first information block through a learnable weight matrix.

[0147] Step 2: Hidden state at time step t Perform a linear transformation to obtain the key and value.

[0148] Step 3: After determining the query, key, and value, calculate the attention weight between the query and key using the cross-attention algorithm, and multiply the attention weight by the value to obtain the candidate output at time step t. .

[0149] Step 4: Compare query Q with candidate outputs Add them together to get the output at time step t. .

[0150] 3) Maximum similarity retrieval output Calculate the similarity between a query vector and the hidden state vectors of all memory slots, and then select the hidden state vectors of the one or N memory slots with the highest similarity as the output. Here, N is less than the number of memory slots.

[0151] In this embodiment of the application, the query vector is used to retrieve information related to the task output from memory (i.e., hidden state).

[0152] In the embodiments of this application, the query vector can have multiple sources. For example, in some embodiments, the query vector can be the original input or a transformed form of the original input (e.g., transformed through a linear layer or neural network). In some embodiments, the query vector can also be a first information block extracted from the original input, or one or more sub-information blocks of the first information block, or a transformed form of the first information block (such as linear projection transformation, attention pooling, etc.). In some embodiments, the query vector can also be the updated hidden state vector of the memory slot. In some embodiments, the query vector can also be set by an expert according to the task requirements of the deep learning task, and so on.

[0153] In the embodiments of this application, the similarity between the query vector and the hidden state vector of each memory slot can include, but is not limited to, the following: cosine similarity, dot product similarity, additive similarity, etc.

[0154] The above is a description of the various working units of the data processing apparatus 100 provided in the embodiments of this application. The data processing method provided in the embodiments of this application can be implemented based on the data processing apparatus 100.

[0155] See Figure 8 , Figure 8 The flowchart of the data processing method provided in the embodiments of this application is illustrated below: S801. Obtain the first raw input of the sequence model at the first time step.

[0156] In this embodiment, the first original input is a multidimensional vector. This multidimensional vector can be a feature representation of the current original observation. The current original observation refers to sensory data directly obtained from the environment or task, such as a raw description of the environmental state, heterogeneous data collected synchronously by multiple sensors, etc. By standardizing the original observation (e.g., data format unification, numerical range normalization, multi-source data alignment, etc.), it is converted into a multidimensional vector suitable for sequence model processing and used as the input to the sequence model, i.e., the first original input.

[0157] For example, in a non-player character agent in a game, the current raw observation can be a 64×64 pixel RGB image of the current game interface. By processing this image through format conversion, numerical normalization, data structure flattening, etc., a 12288-dimensional vector containing the pixel values ​​of each pixel in the RGB image across each color channel is obtained; this is the first raw input. The first raw input is a 12288-dimensional vector, where each data element corresponds to the pixel value of a color channel of a pixel in the current game interface.

[0158] S802. Perform feature extraction on the first original input to obtain the first information block.

[0159] In this embodiment, the first information block can also be a multi-dimensional vector, but the vector dimension of the first information block is lower than the vector dimension of the first original input. For example, the first original input is a k-dimensional vector, and the first information block is an m-dimensional vector, where m is less than k.

[0160] The first information block may include multiple sub-information blocks. See also Figure 4 The first information block shown is a multi-dimensional vector, in which each data element can be regarded as a sub-information block, and each information block can be a key feature extracted from the first original input.

[0161] Continuing with the example of the non-player character agent in the S801 game, the first original input is a 12288-dimensional vector, recording the pixel values ​​of the game screen. Feature extraction can compress this 12288-dimensional vector into an m-dimensional vector, thus obtaining the first information block. Here, m is less than 12288. The m sub-information blocks in the first information block can each correspond to one of the m key features extracted from the first original input, such as the user's own health, user's own coordinates, opponent's health, opponent's coordinates, etc.

[0162] In some implementations, the method for extracting features from a first original input to obtain a first information block may include: first, reducing the dimensionality of the first original input through a linear layer to obtain a first feature vector, and generating a first gating coefficient based on the first original input. Then, scaling the value of the first feature vector using the first gating coefficient to generate the first information block.

[0163] In other embodiments, the method for extracting features from the first original input to obtain the first information block may include: calculating the correlation weights between the features of the first original input, and weighting and aggregating the features of the first original input based on the calculated correlation weights to finally generate the first information block.

[0164] For details on extracting features from the first original input to obtain the first information block, please refer to the previous introduction; it will not be repeated here.

[0165] In the embodiments of this application, steps S801 and S802 can be executed by the input compression unit 101 described above.

[0166] S803. Update the hidden state of the memory unit in the sequence model at the second time step using the first information block to obtain the hidden state of the memory unit at the first time step. The second time step is the time step before the first time step.

[0167] The memory unit can be the multi-slot memory unit 102 described above. The hidden state of the memory unit in the second time step can include the hidden state vectors of multiple memory slots of the multi-slot memory unit 102 in the second time step.

[0168] In this embodiment, the hidden state of the memory unit may include multiple hidden state vectors. These multiple hidden state vectors can be used to remember different information obtained from the input, such as information of different types, information of different dimensions, information from different sources, etc.

[0169] In this embodiment, the number of sub-information blocks in the first information block is the same as the number of hidden state vectors in the memory unit. That is, the first information block includes multiple sub-information blocks, and the hidden state of the memory unit also includes m hidden state vectors. Each sub-information block of the first information block can correspond one-to-one with multiple hidden state vectors of the memory unit in the second time step, and one sub-information block of the first information block is used to update one of the hidden state vectors of the memory unit in the second time step that corresponds to it.

[0170] Continuing with the example of the non-player character AI agent in S801-S802, the hidden states of the memory unit include m hidden state vectors, each used to remember different types of information. For example, hidden state vector 1 remembers the user's own health, hidden state vector 2 remembers the user's own coordinates, hidden state vector 3 remembers the opponent's health, hidden state vector 4 remembers the opponent's coordinates, and so on. It can be observed that the types of information remembered by the multiple hidden state vectors of the memory unit correspond one-to-one with the types of information in the multiple sub-information blocks of the first information block. Therefore, when updating the m hidden state vectors of the hidden state memory unit at the second time step, the m hidden state vectors of the second time step can be updated using multiple sub-information blocks of the first information block. For example, the hidden state vector 1 used to transmit its own health information can be updated using information block 1 in the first information block; the hidden state vector 2 used to transmit its own coordinate information can be updated using information block 2 in the first information block; the hidden state vector 3 used to transmit the opponent's health information can be updated using information block 3 in the first information block; the hidden state vector 4 used to transmit the opponent's coordinate information can be updated using information block 4 in the first information block, and so on.

[0171] In some implementations, the method of updating the hidden state of memory units in the sequence model at the second time step using the first information block to obtain the hidden state of memory units at the first time step may include: first multiplying the hidden state of memory units at the second time step by a forgetting parameter to obtain the forgotten hidden state; then generating the hidden state of memory units at the first time step based on the forgotten hidden state and the first information block. The forgetting parameter is used to control the degree of forgetting of the hidden state at the second time step.

[0172] Specifically, in some implementations, there are m forgetting parameters, each of which corresponds one-to-one with a hidden state vector. One of the m forgetting parameters is used to control the degree of forgetting of a hidden state vector that corresponds to a forgetting parameter among the m hidden state vectors.

[0173] In some implementations, the method of updating the hidden state of the memory unit in the sequence model at the second time step using the first information block to obtain the hidden state of the memory unit at the first time step may include: firstly calculating the similarity between the first information block and the hidden state vector of each memory slot using a similarity algorithm, and generating a write weight corresponding to each memory slot based on the calculated similarity; then multiplying the first information block by the write weight, and then adding it to the hidden state of the multi-slot memory unit 102 at the second time step to obtain the hidden state of the multi-slot memory unit 102 at the first time step.

[0174] In some implementations, the method of updating the hidden state of the memory cell in the sequence model at the second time step using the first information block to obtain the hidden state of the memory cell at the first time step may include: the memory cell is provided with multiple gated loop units, which are used to update the hidden state vectors of multiple memory slots respectively, thereby updating the hidden state of the multi-slot memory cell 102.

[0175] For details on the method of updating the hidden state of the memory unit in the sequence model at the second time step using the first information block to obtain the hidden state of the memory unit at the first time step, please refer to the previous introduction, which will not be repeated here.

[0176] In this embodiment of the application, step S803 can be performed by the multi-slot memory unit 102.

[0177] S804. The output of the sequence model at the first time step is generated using the first information block and the memory unit in the hidden state at the first time step.

[0178] In some implementations, the method of generating the output of the sequence model at the first time step using the first information block and the hidden state of the memory unit at the first time step may include: first generating a second gating coefficient matrix based on the first information block, and then using the second gating coefficient matrix as weights to perform a weighted summation of the first information block and the hidden state of the multi-slot memory unit 102 at the first time step to generate the output of the sequence model at the first time step.

[0179] In some implementations, the method for generating the output of the sequence model at the first time step using the first information block and the hidden state of the memory unit at the first time step may include: calculating the similarity between the first query vector and the hidden state vectors of all memory slots, and then selecting the hidden state vector of one or N memory slots with the highest similarity as the output. Here, N is less than the number of memory slots, and the first query vector is any one of the following: the first information block, a linear transformation of the first information block, the first original input, a linear transformation of the first original input, a hidden state vector of the memory unit at the first time step, or a preset query vector.

[0180] For details on how to generate the output of the sequence model at the first time step using the hidden state of the first information block and memory unit at the first time step, please refer to the previous introduction; it will not be repeated here.

[0181] As mentioned above, the output of the sequence model can be used as the input to the downstream decision network in the deep learning network, which then makes decisions based on the data from the sequence model.

[0182] Continuing with the example of the non-player character agent in S801-S803, the hidden state of the first time step, obtained by updating the hidden state of the second time step using the first information block, contains information learned by the sequence model from the game data received from the first time step and all time steps before it, including its own health, its own coordinates, the opponent's health, the opponent's coordinates, etc. Then, the sequence model can generate the output of the first time step based on the hidden state and the first original input. The downstream decision network then generates the next action of the non-player character agent, such as launching an attack on the opponent, based on the information contained in this output and the decision algorithm.

[0183] In this embodiment of the application, step S804 can be executed by the output retrieval unit 103.

[0184] Figure 9 The hardware structure of the data processing apparatus 100 provided in the embodiments of this application is illustrated by way of example.

[0185] like Figure 9 As shown, the data processing device 100 may include: input / output modules (including an audio input / output module 318, a key input module 316, and a display 320, etc.), a communication interface 301, a user interface 302, one or more processors 304, a transmitter 306, a receiver 308, a coupler 310, an antenna 314, and a memory 312. These components can be connected via a bus or other means. Figure 9 Taking a bus connection as an example: The communication interface 301 can be used by the data processing device 100 to communicate with other communication devices, such as base stations. Specifically, the communication interface 301 may include one or more of the following: a Global System for Mobile Communication (GSM) (2G) communication interface, a Wideband Code Division Multiple Access (WCDMA) (3G) communication interface, and a Long Term Evolution (LTE) (4G) communication interface, or a 5G or future New Radio (NR) communication interface. Not limited to wireless communication interfaces, the data processing device 100 may also be configured with a wired communication interface 301, such as a Local Access Network (LAN) interface.

[0186] Antenna 314 can be used to convert electromagnetic energy in a transmission line into electromagnetic waves in free space, or to convert electromagnetic waves in free space into electromagnetic energy in a transmission line. Coupler 310 is used to split the mobile communication signal received by antenna 314 into multiple paths and distribute them to multiple receivers 308.

[0187] Transmitter 306 can be used to transmit signals output by processor 304, and receiver 308 can be used to receive mobile communication signals received by antenna 314. In some embodiments of this application, transmitter 306 and receiver 308 can be considered as a wireless modem. In data processing device 100, the number of transmitters 306 and receivers 308 can be one or more.

[0188] Apart from Figure 9 The transmitter 306 and receiver 308 shown may be accompanied by other communication components in the data processing device 100, such as a GPS module, a Bluetooth module, or a Wi-Fi module. Beyond the wireless communication signals described above, the data processing device 100 may also support other wireless communication signals, such as satellite signals and shortwave signals. In addition to wireless communication, the data processing device 100 may also be configured with a wired network interface (such as a LAN interface) to support wired communication.

[0189] The input / output module is used to realize the interaction between the data processing device 100 and the user / external environment, and may mainly include an audio input / output module 318, a key input module 316, and a display 320. Specifically, the input / output module may also include a camera, a touch screen, and sensors, etc. All input / output modules communicate with the processor 304 through the user interface 302.

[0190] Memory 312 is coupled to processor 304 and is used to store various software programs and / or multiple sets of instructions. Specifically, memory 312 may include high-speed random access memory and may also include non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices. Memory 312 may store an operating system (hereinafter referred to as the system), such as embedded operating systems like Android, iOS, Windows, or Linux. Memory 312 may also store a network communication program, which can be used to communicate with one or more additional devices, one or more terminal devices, or one or more network devices. Memory 312 may also store a user interface program, which can realistically display the content of the application through a graphical user interface and receive user control operations on the application through input controls such as menus, dialog boxes, and buttons.

[0191] In some embodiments of this application, memory 312 may be used to store the implementation program of the data processing method provided in one or more embodiments of this application on the data processing device 100 side.

[0192] The processor 304 can be used to read and execute computer-readable instructions. Specifically, the processor 304 can be used to call a program stored in the memory 312, such as the implementation program of the data processing method provided in one or more embodiments of this application on the data processing device 100 side, and execute the instructions contained in the program.

[0193] It needs to be explained that, Figure 9 The data processing device 100 shown is merely one implementation of the embodiments of this application. In actual applications, the data processing device 100 may include more or fewer components, which is not limited here.

[0194] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0195] The above detailed embodiments further illustrate the purpose, technical solution, and beneficial effects of the embodiments of this application. It should be understood that the above are merely specific embodiments of the embodiments of this application and are not intended to limit the protection scope of the embodiments of this application. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solutions of the embodiments of this application should be included within the protection scope of the embodiments of this application.

Claims

1. A data processing method, characterized in that, The method includes: Obtain the first raw input of the sequence model at the first time step; Feature extraction is performed on the first original input to obtain a first information block, the dimension of the first information block being lower than the dimension of the first original input; The hidden state of the memory unit of the sequence model at the second time step is updated using the first information block to obtain the hidden state of the memory unit at the first time step. The second time step is the time step preceding the first time step. The first information block includes m sub-information blocks, and the hidden state at the second time step includes m hidden state vectors. Each of the m sub-information blocks corresponds one-to-one with one of the m hidden state vectors. One of the m sub-information blocks is used to update a hidden state vector in the m hidden state vectors that corresponds to that specific sub-information block. m is an integer not less than 1. Feature extraction is performed on the hidden states of the first information block and the memory unit at the first time step to obtain the output of the sequence model at the first time step.

2. The method as described in claim 1, characterized in that, The step of updating the hidden state of the memory unit of the sequence model at the second time step using the first information block to obtain the hidden state of the memory unit at the first time step specifically includes: Multiply the hidden state of the memory unit at the second time step with the forgetting parameter to obtain the hidden state after forgetting; Based on the forgotten hidden state and the first information block, the hidden state of the memory unit at the first time step is generated; The forgetting parameter is used to control the degree of forgetting of the hidden state of the second time step.

3. The method as described in claim 2, characterized in that, There are m forgetting parameters, and each of the m forgetting parameters corresponds one-to-one with one of the m hidden state vectors. One of the m forgetting parameters is used to control the degree of forgetting of one of the hidden state vectors that corresponds to the forgetting parameter.

4. The method as described in claim 1, characterized in that, The step of updating the hidden state of the memory unit of the sequence model at the second time step using the first information block to obtain the hidden state of the memory unit at the first time step specifically includes: Write weights are generated based on the first information block and the hidden state of the second time step; The result of multiplying the first information block by the write weight is added to the hidden state of the memory cell at the first time step to obtain the hidden state of the memory cell at the first time step. The write weights include m, and each of the m write weights corresponds one-to-one with one of the m hidden state vectors.

5. The method according to any one of claims 1-4, characterized in that, The step of extracting features from the first original input to obtain the first information block specifically includes: The first feature vector is obtained by reducing the dimensionality of the first original input through the linear layer of the sequence model. Generate the first gating coefficient based on the first original input; The value of the first feature vector is scaled using the first gating coefficient to generate the first information block.

6. The method according to any one of claims 1-5, characterized in that, The step of extracting features from the hidden states of the first information block and the memory unit at the first time step to obtain the output of the sequence model at the first time step specifically includes: Calculate the similarity between the hidden state vectors of the memory unit at the first time step and the first query vector; The one or more hidden state vectors with the highest similarity are used as the output of the sequence model at the first time step; Wherein, the first query vector is any one of the following: the first information block, the linear transformation form of the first information block, the first original input, the linear transformation form of the first original input, a hidden state vector of the hidden state of the memory unit at the first time step, or a preset query vector.

7. The method according to any one of claims 1-5, characterized in that, The step of extracting features from the hidden states of the first information block and the memory unit at the first time step to obtain the output of the sequence model at the first time step specifically includes: The first weight and the second weight are determined based on the first information block; The first information block and the hidden state of the memory unit at the first time step are weighted and summed using the first weight and the second weight to generate the output of the sequence model at the first time step.

8. A data processing apparatus, characterized in that, The data processing device includes an input compression unit, a memory unit, and an output retrieval unit, wherein... The input compression unit is used to obtain the first original input of the sequence model at the first time step, and then perform feature extraction on the first original input to obtain a first information block. The dimension of the first information block is lower than the dimension of the first original input. The memory unit is used to update the hidden state of the memory unit in the sequence model at the second time step using the first information block, so as to obtain the hidden state of the memory unit at the first time step, where the second time step is the time step preceding the first time step. The output retrieval unit is used to extract features from the first information block and the hidden state of the memory unit at the first time step to obtain the output of the sequence model at the first time step. Wherein, the first information block includes m sub-information blocks, the hidden state includes m hidden state vectors, the m sub-information blocks correspond one-to-one with the m hidden state vectors, and one of the m sub-information blocks is used to update one of the hidden state vectors that corresponds to the one sub-information block; m is an integer not less than 1.

9. The apparatus as claimed in claim 8, characterized in that, The step of updating the hidden state of the memory unit of the sequence model at the second time step using the first information block to obtain the hidden state of the memory unit at the first time step specifically includes: Multiply the hidden state of the memory unit at the second time step with the forgetting parameter to obtain the hidden state after forgetting; Based on the forgotten hidden state and the first information block, the hidden state of the memory unit at the first time step is generated; The forgetting parameter is used to control the degree of forgetting of the hidden state of the second time step.

10. The apparatus as claimed in claim 9, characterized in that, There are m forgetting parameters, and each of the m forgetting parameters corresponds one-to-one with one of the m hidden state vectors. One of the m forgetting parameters is used to control the degree of forgetting of one of the hidden state vectors that corresponds to the forgetting parameter.

11. The apparatus as claimed in claim 8, characterized in that, The step of updating the hidden state of the memory unit of the sequence model at the second time step using the first information block to obtain the hidden state of the memory unit at the first time step specifically includes: Write weights are generated based on the first information block and the hidden state of the second time step; The result of multiplying the first information block by the write weight is added to the hidden state of the memory cell at the first time step; wherein, the write weight includes m, and the m write weights correspond one-to-one with the m hidden state vectors.

12. The apparatus according to any one of claims 8-11, characterized in that, The step of extracting features from the first original input to obtain the first information block specifically includes: The first feature vector is obtained by reducing the dimensionality of the first original input through the linear layer of the sequence model. Generate the first gating coefficient based on the first original input; The value of the first feature vector is scaled using the first gating coefficient to generate the first information block.

13. The apparatus according to any one of claims 8-12, characterized in that, The step of extracting features from the hidden states of the first information block and the memory unit at the first time step to obtain the output of the sequence model at the first time step specifically includes: Calculate the similarity between the hidden state vectors of the memory unit at the first time step and the first query vector; The one or more hidden state vectors with the highest similarity are used as the output of the sequence model at the first time step; Wherein, the first query vector is any one of the following: the first information block, the linear transformation form of the first information block, the first original input, the linear transformation form of the first original input, a hidden state vector of the hidden state of the memory unit at the first time step, or a preset query vector.

14. The apparatus according to any one of claims 8-12, characterized in that, The step of extracting features from the hidden states of the first information block and the memory unit at the first time step to obtain the output of the sequence model at the first time step specifically includes: The first weight and the second weight are determined based on the first information block; The first information block and the hidden state of the memory unit at the first time step are weighted and summed using the first weight and the second weight to generate the output of the sequence model at the first time step.

15. A data processing apparatus, characterized in that, It includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method according to any one of claims 1-7.

16. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-7.

17. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-7.