Data processing method and related device

By splicing strings requested by multiple users into fixed-length vectors, the problem of low efficiency in processing dynamic-length inputs in online inference services is solved, efficient processing of language models is achieved, and the inference speed is significantly accelerated.

WO2024199423A1PCT designated stage expired Publication Date: 2024-10-03HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/084716
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-30
Filing Date
2024-03-29
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

When existing online inference services process text input by users, it is difficult to process dynamic length input, resulting in low processing efficiency, inability to effectively improve response speed, and affecting the user experience of practical applications.

Method used

By obtaining the strings requested by multiple users and concatenating them into fixed-length vectors to form static input data, it ensures that the language model processes multiple user requests at one time and improves processing efficiency.

Benefits of technology

It is possible to improve the processing efficiency of the language model while maintaining the static consistency of the input data. It is suitable for uneven busy and idle scenarios of online services and significantly accelerates the inference speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024084716_03102024_PF_FP_ABST
    Figure CN2024084716_03102024_PF_FP_ABST
Patent Text Reader

Abstract

A data processing method, applied to the field of natural language processing. The method comprises: acquiring a plurality of first character strings, wherein different first character strings correspond to different user requests; splicing the plurality of first character strings into first input data, wherein the first input data comprises a plurality of vectors having a same length, each vector comprises at least one first character string, the length of each vector is a preset fixed length, and the number of vectors comprised in the first input data is a preset fixed number, wherein at least one vector comprises a character which does not belong to the plurality of first character strings and is used for padding the length of the vector to a fixed size; and inputting the first input data as one piece into a language model. According to the present application, under the condition that the size of input data input into a language model each time is kept static and consistent, the input data is obtained by splicing character strings based on a plurality of user requests, such that the language model can process the plurality of user requests at one time, and the processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

A data processing method and related equipment

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on March 30, 2023, with application number 202310361510.0 and invention name “A data processing method and related equipment”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of artificial intelligence, and in particular to a data processing method and related equipment. Background Art

[0003] Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that seeks to understand the essence of intelligence and develop new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.

[0004] With the rapid development of natural language processing technology, language models have been widely applied in various natural language processing tasks, such as sentiment classification, question answering, and sequence labeling. In actual deployment and use of language models, people typically use an online inference service process. This process is as follows: a request queue waits for user queries to be submitted. After the request queue collects user queries, the controller module (scheduler) reads the queries and passes them to the language model. The language model processes the user input and returns the output to the user. Online inference services for language models have very high response speed requirements, which is also closely related to the actual user experience.

[0005] In existing implementations, the text in user input requests varies in length, and the computing chips used for online inference often have difficulty processing dynamic-length input. Therefore, it is necessary to pad the user requests to a fixed length and input the corresponding character strings into the language model in sequence, resulting in low processing efficiency.

[0006] Summary of the Invention

[0007] The present application provides a data processing method that ensures that the size of the input data input into the language model each time remains statically consistent. The input data is obtained by concatenating character strings based on multiple user requests, so that the language model can process multiple user requests at a time, thereby improving processing efficiency.

[0008] In a first aspect, the present application provides a data processing method, comprising: obtaining multiple first character strings; different first character strings correspond to different user requests; concatenating the multiple first character strings into first input data; the first input data comprises multiple vectors of the same length, each of the vectors comprises at least one first character string, the length of each vector is a preset fixed length, the number of vectors included in the first input data is a preset fixed number, wherein at least one of the vectors comprises characters that do not belong to the multiple first character strings and are used to complete the length of the vector to the fixed size; the first input data as a whole is input into a language model as input data.

[0009] Through the above method, it is ensured that the size of the input data input into the language model each time remains statically consistent. The input data is obtained by concatenating character strings based on multiple user requests, so that the language model can process multiple user requests at a time, thereby improving processing efficiency.

[0010] In one possible implementation, the method further includes: obtaining multiple second character strings; the second character strings and the first character string correspond to different user requests, and different second character strings correspond to different user requests; processing the multiple second character strings into second input data; the second input data and the first input data have the same size; and inputting the first input data as a whole into a language model as one input data.

[0011] In one possible implementation, the acquisition time of the user request corresponding to the second character string is after the acquisition time of the user request corresponding to the second character string; the method further includes: after processing the multiple first character strings as first input data, storing the first input data in a first-in-first-out queue; processing the multiple second character strings as second input data includes: based on sufficient storage space in the first-in-first-out queue, processing the multiple second character strings as second input data.

[0012] In a possible implementation, inputting the first input data into the language model includes: based on the language model being in an idle state, inputting the first input data stored in the first-in-first-out queue into the language model.

[0013] Online splicing adopts the producer-consumer model, which is suitable for scenarios where online services are unevenly loaded and idle. It ensures static inference dimensions and is compatible with inference hardware.

[0014] In one possible implementation, the multiple first character strings include a first target character string; and the splicing of the multiple first character strings into the first input data includes: splicing multiple first character strings other than the first target character string in the multiple first character strings to obtain M vectors; and splicing the first target character string to a target vector in the M vectors to obtain a spliced ​​target vector, where the target vector is the shortest vector in the M vectors, and the length of the spliced ​​target vector is less than or equal to the fixed length.

[0015] In a possible implementation, the number of first character strings included in each of the multiple vectors with the same length is smaller than a threshold.

[0016] It adopts the shortest data first splicing scheme and uses the greedy method to splice according to the data length. It has a fast splicing speed and is suitable for streaming data input in online services.

[0017] In one possible implementation, because the first input data includes multiple first character strings, and different character strings correspond to different user requests, it is necessary to distinguish between the different character strings during position encoding. Specifically, the first input data as a whole can be input into a language model as a single input data, along with position information corresponding to the first input data. The position information indicates the position of each character unit in the multiple first character strings within the first input data, as well as the first character string to which each character unit belongs. The position embedding layer in the language model can perform position encoding based on the input position information.

[0018] In addition, the model output needs to be unstitched. For multiple data items spliced ​​into a sequence, it is necessary to understand the number of each data item and its starting and ending positions in the spliced ​​data so that the output can be mapped to the original data.

[0019] In a possible implementation, the first input data can be processed by the language model to obtain a processing result corresponding to the first input data; and the processing result can be split into multiple sub-processing results based on the location information, each sub-processing result corresponding to one of the user requests.

[0020] In one possible implementation, because the first input data includes multiple first character strings, and different character strings correspond to different user requests, it is necessary to distinguish the different character strings during feature extraction, and to ensure that the processing processes are independent of each other. When performing attention calculations, there is no interaction between the different first character strings. Specifically, the first input data can be processed by the language model; the language model includes an attention module, which is configured to perform an attention operation on the first input data based on attention information, and the attention information indicates that when performing the attention operation, there is no attention interaction between the different first character strings in the first input data.

[0021] In one possible implementation, the attention information is a block diagonal matrix.

[0022] In a second aspect, the present application provides a data processing device, comprising:

[0023] An acquisition module, configured to acquire a plurality of first character strings, wherein different first character strings correspond to different user requests;

[0024] a processing module configured to concatenate the plurality of first character strings into first input data; the first input data comprising a plurality of vectors of the same length, each vector comprising at least one first character string, the length of each vector being a preset fixed length, the number of vectors included in the first input data being a preset fixed number, wherein at least one of the vectors comprises a character that does not belong to the plurality of first character strings and is used to complete the length of the vector to the fixed length;

[0025] The first input data as a whole is taken as input data and input into the language model.

[0026] In a possible implementation, the acquisition module is further configured to:

[0027] Acquire multiple second character strings; the second character strings and the first character string correspond to different user requests, and different second character strings correspond to different user requests;

[0028] Processing the plurality of second character strings as second input data; wherein the second input data has the same size as the first input data;

[0029] The first input data as a whole is taken as input data and input into the language model.

[0030] In a possible implementation, the acquisition time of the user request corresponding to the second character string is later than the acquisition time of the user request corresponding to the second character string;

[0031] The processing module is further configured to:

[0032] After processing the plurality of first character strings into first input data, storing the first input data in a first-in-first-out queue;

[0033] The processing module is specifically used to:

[0034] Based on the storage space of the first-in-first-out queue being sufficient, the plurality of second character strings are processed as second input data.

[0035] In a possible implementation, the processing module is specifically configured to:

[0036] Based on the language model being in an idle state, first input data stored in the first-in-first-out queue is input into the language model.

[0037] In a possible implementation, the multiple first character strings include a first target character string; and the processing module is specifically configured to:

[0038] splicing multiple first character strings excluding the first target character string from the multiple first character strings to obtain M vectors;

[0039] The first target character string is concatenated to a target vector in the M vectors to obtain a concatenated target vector, where the target vector is the shortest vector in the M vectors, and the length of the concatenated target vector is less than or equal to the fixed length.

[0040] In a possible implementation, the number of first character strings included in each of the multiple vectors with the same length is smaller than a threshold.

[0041] In a possible implementation, the processing module is specifically configured to:

[0042] The first input data as a whole is taken as an input data and the position information corresponding to the first input data is input into the language model; the position information is used to indicate the position information of each character unit in the multiple first character strings in the first input data, and the first character string to which each character unit belongs.

[0043] In a possible implementation, the processing module is further configured to:

[0044] Processing the first input data using the language model to obtain a processing result corresponding to the first input data;

[0045] The processing result is split into multiple sub-processing results according to the location information, and each sub-processing result corresponds to one of the user requests.

[0046] In a possible implementation, the processing module is further configured to:

[0047] The first input data is processed by the language model; the language model includes an attention module, and the attention module is used to perform an attention operation on the first input data based on attention information, and the attention information indicates that when the attention operation is performed, there is no attention interaction between different first character strings in the first input data.

[0048] In one possible implementation, the attention information is a block diagonal matrix.

[0049] In the third aspect, an embodiment of the present application provides an execution device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform steps related to model reasoning in any optional method in the first and second aspects above.

[0050] In a fourth aspect, an embodiment of the present application provides a training device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform steps related to model training in any optional method in the first and second aspects above.

[0051] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method thereof, or the above-mentioned second aspect and any optional method thereof.

[0052] In a sixth aspect, an embodiment of the present application provides a computer program which, when executed on a computer, enables the computer to execute the above-mentioned first aspect and any optional method thereof, or the above-mentioned second aspect and any optional method thereof.

[0053] In a seventh aspect, the present application provides a chip system comprising a processor for supporting a training device or an execution device in implementing the functions described in the aforementioned aspects, such as transmitting or processing data or information involved in the aforementioned methods. In one possible design, the chip system further comprises a memory for storing program instructions and data necessary for the execution device or training device. The chip system may be comprised of a single chip or a combination of a chip and other discrete components. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 is a schematic diagram of the structure of the artificial intelligence main framework;

[0055] Figure 2 is a natural language processing system;

[0056] Figure 3a shows another natural language processing system;

[0057] Figure 3b is a schematic structural diagram of a system;

[0058] FIG4 is a schematic diagram of a device related to natural language processing provided in an embodiment of the present application;

[0059] Figure 5 is a schematic diagram of the architecture of a transformer layer;

[0060] FIG6A is a schematic diagram of an embodiment of a data processing method provided in an embodiment of the present application;

[0061] FIG6B is a schematic diagram of an embodiment of a model training method;

[0062] FIG6C is a schematic diagram of the structure of a transformer layer;

[0063] Figure 6D is a schematic diagram of the operation of an attention head;

[0064] FIG7 is a schematic diagram of location information provided in an embodiment of the present application;

[0065] FIG8 is a schematic diagram of a block diagonal matrix provided in an embodiment of the present application;

[0066] FIG9 is a schematic diagram of an embodiment of a data processing method provided in an embodiment of the present application;

[0067] FIG10 is a schematic diagram of an application architecture provided in an embodiment of the present application;

[0068] FIG11 is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0069] FIG12 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;

[0070] FIG13 is a schematic diagram of a structure of an execution device provided in an embodiment of the present application;

[0071] FIG14 is a schematic diagram of a structure of a training device provided in an embodiment of the present application;

[0072] FIG15 is a schematic structural diagram of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0073] The following describes the embodiments of the present application in conjunction with the accompanying drawings. The terms used in the implementation methods of the embodiments of the present application are only used to explain the specific embodiments of the embodiments of the present application, and are not intended to limit the embodiments of the present application.

[0074] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0075] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0076] First, let's describe the overall workflow of an AI system. See Figure 1, which shows a schematic diagram of the AI ​​framework. This framework will be explained from two perspectives: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects the entire process from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. Throughout this process, data undergoes a condensed journey from "data-information-knowledge-wisdom." The "IT value chain," spanning the underlying infrastructure of human intelligence, information (provided and processed by technology), and the system's industrial ecosystem, reflects the value that AI brings to the information technology industry.

[0077] (1) Infrastructure

[0078] Infrastructure provides computing power for AI systems, enabling communication with the outside world and supporting this through a foundational platform. External communication occurs through sensors; computing power is provided by intelligent chips (CPUs, NPUs, GPUs, ASICs, FPGAs, and other hardware accelerators). The foundational platform includes a distributed computing framework and network-related platform guarantees and support, including cloud storage and computing, and interconnected networks. For example, sensors communicate with the outside world to acquire data, which is then fed into the intelligent chips within the distributed computing system provided by the foundational platform for computation.

[0079] (2) Data

[0080] Data above the infrastructure layer represents data sources for AI. This data includes graphics, images, voice, and text, as well as IoT data from traditional devices. This includes business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.

[0081] (3) Data processing

[0082] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.

[0083] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.

[0084] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.

[0085] Decision-making refers to the process of making decisions after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.

[0086] (4) General ability

[0087] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0088] (5) Smart products and industry applications

[0089] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical application. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.

[0090] This application can be applied to the field of natural language processing in the field of artificial intelligence. Below, taking natural language processing as an example, multiple application scenarios implemented in products will be introduced.

[0091] In order to better understand the solution of the embodiment of the present application, the following briefly introduces the possible application scenarios of the embodiment of the present application with reference to Figures 2 to 3a.

[0092] Figure 2 shows a natural language processing system, which includes user devices and data processing equipment. User devices include intelligent terminals such as mobile phones, personal computers, or information processing centers. User devices are the initiators of natural language data processing, initiating requests such as language questions and answers or inquiries. Typically, users initiate requests through their user devices.

[0093] The aforementioned data processing devices can be devices or servers with data processing capabilities, such as cloud servers, network servers, application servers, and management servers. The data processing devices receive query statements, voice, text, and other information from smart terminals via interactive interfaces. They then use their memory and processors to perform language data processing, including machine learning, deep learning, search, reasoning, and decision-making, and then feed the results back to the user device. The memory in a data processing device is a general term encompassing both local storage and databases storing historical data. The databases can be located on the data processing device or on other network servers.

[0094] In the natural language processing system shown in Figure 2, the user device can receive user instructions. For example, the user device can receive a piece of text input by the user, and then initiate a request to the data processing device, so that the data processing device executes a natural language processing application (such as natural language generation, text classification, text reasoning, named entity recognition, translation, etc.) for the piece of text obtained by the user device, thereby obtaining the processing results of the corresponding natural language processing application for the piece of text (such as predicted word results, classification results, reasoning results, named entity recognition results, translation results, etc.).

[0095] Taking natural language generation (NLG) as an example, also known as text prediction or natural language synthesis, it involves generating missing or subsequent text within a given text segment. NLG is widely used in search engines, input methods, and other scenarios. It can predict a user's next input based on partial text, significantly improving user efficiency. It can also recover text with missing text.

[0096] The universal performance of pre-trained models allows them to learn general language knowledge from large-scale corpora. Therefore, downstream tasks and applications related to the training corpus of pre-trained language models are the focus of attention. Related tasks include General Language Understanding Evaluation (GLUE), Question Answering, Sentiment Analysis, Named Entity Recognition, Machine Translation, Text Summarization, and Named Entity Recognition.

[0097] General Language Understanding Evaluation (GLUE): The benchmark consists of nine natural language understanding task datasets, including single sentence classification, text pair classification, text similarity, and ranking tasks. The latest improved version, SuperBLUE, includes a wider variety of tasks than GLUE.

[0098] Question Answering (QA): Question answering is a submodule within reading comprehension. From simple to difficult, QA can be divided into three types: single-round extractive QA, multi-round generative QA, and multi-hop QA. For extractive QA tasks, researchers proposed a retrospective reading model and used a pretrained model to initialize the encoder. For multi-round generative QA tasks, some researchers proposed a "pretrained model + adversarial training + logical annotation + knowledge distillation" model. For multi-hop QA, some researchers proposed an interpretable "select, answer, and explain" system using a pretrained language model as the encoder.

[0099] Sentiment Analysis: Researchers achieved state-of-the-art results on the SST-2 sentiment classification dataset by fine-tuning pre-trained language models. However, direct fine-tuning on the more fine-grained sentiment classification task, ABSA, yielded only modest results. Some researchers have shifted the ABSA task from single-sentence classification to sentence-pair classification. Others have also achieved good results using incremental training on pre-trained language models on ABSA.

[0100] Machine Translation: Machine translation is a crucial task in Natural Language Processing (NLP). Neural network-based translation models typically employ an encoder-decoder framework, encoding the input text into a latent representation and decoding the latent representation into the target language text. Researchers have attempted to use the multilingual pre-trained language model BERT to initialize the encoder and decoder in NMT, achieving significant improvements in both unsupervised translation and English-to-Roman translation.

[0101] Text Summarization: The task of text summarization is to generate a short text segment that represents the core meaning of a long text. The introduction of pre-trained models has greatly improved the performance of summarization tasks. Researchers have attempted to train pre-trained language models by directly predicting sentences at the article level and directly apply them to text summarization tasks.

[0102] Named Entity Recognition: The main purpose of this application is to identify entity words in a sentence and their corresponding entity types. The basic solution to the named entity recognition task is to treat it as a sequence classification task, generally using annotation prediction methods such as BIO and BIOES. The BIO annotation method, among others, labels each word in a sentence with a label. This label consists of two parts: one is the position of the entity to which the word belongs, where B indicates that the word is the first word of the entity, I indicates that the word is the middle word of the entity, and O indicates that it is not an entity. A common model is a pre-trained language model combined with a conditional random field algorithm.

[0103] The data processing methods in the embodiments of the present application can be applied to but not limited to the above application fields.

[0104] Illustratively, in an embodiment of the present application, a user device may receive a piece of text data input by a user, wherein the text data includes known words and words to be predicted, the words to be predicted are invisible, and only the position of the words to be predicted in the text data is known. The user device may then initiate a request to a data processing device (the request carries text data), so that the data processing device predicts the words to be predicted in the text data, thereby obtaining the words to be predicted, and feeding back the words to be predicted to the user device.

[0105] For example, the user device may receive a piece of text data input by the user, and then initiate a request to the data processing device, so that the data processing device performs entity classification on the piece of text data, thereby obtaining an entity classification result for the piece of text data, and feeding the entity classification result back to the user device;

[0106] For example, the user device can receive a piece of text data input by the user (the text data is Chinese text), and then initiate a request to the data processing device, so that the data processing device translates the piece of text data into English, thereby obtaining an English translation for the piece of text data, and feeding the English translation back to the user device.

[0107] Figure 3a shows another natural language processing system. In Figure 3a, the user device directly serves as a data processing device. The user device can directly receive input from the user and process it directly by the hardware of the user device itself. The specific process is similar to that of Figure 2. Please refer to the above description and will not be repeated here.

[0108] FIG4 is a schematic diagram of a natural language processing-related device 300 provided in an embodiment of the present application.

[0109] The user device in the above Figures 2 and 3a can specifically be the local device 301 or the local device 302 in Figure 4, and the data processing device in Figure 2 can specifically be the execution device 310 in Figure 4, wherein the data storage system 350 can store the data to be processed of the execution device 310, and the data storage system 350 can be integrated on the execution device 310, or it can be set on the cloud or other network servers.

[0110] The processors in Figures 2 and 3a can perform data training / machine learning / deep learning through neural network models or other models, and use the models finally trained or learned from the data to perform natural language processing applications (such as natural language generation, text classification, sequence labeling, reading comprehension, text generation, text reasoning, translation, etc.) on text data to obtain corresponding processing results.

[0111] The following describes the system architecture provided by an embodiment of the present application in detail with reference to Figure 3b. Figure 3b is a schematic diagram of the system architecture provided by an embodiment of the present application. As shown in Figure 3b, system architecture 500 includes an execution device 510, a training device 520, a database 530, a client device 540, a data storage system 550, and a data acquisition system 560.

[0112] The execution device 510 includes a calculation module 511, an I / O interface 512, a pre-processing module 513, and a post-processing module 514. The calculation module 511 may include the target model / rule 501, and the pre-processing module 513 and the post-processing module 514 are optional.

[0113] The data acquisition device 560 is used to collect training data.

[0114] In the task of natural language synthesis, the training data may be text data with missing text and complete text data corresponding to the text data with missing text.

[0115] In translation tasks, training data may include but is not limited to parallel corpora, monolingual corpora, etc.

[0116] Parallel corpus refers to bilingual or multilingual corpora (i.e., annotated text data) consisting of a source text and its corresponding target text. The source and target texts share the same semantics, and there is a correspondence between the text units. For example, if the source text is "This trip needs careful planning," and its English counterpart is "The trip needs careful planning," then "This trip needs careful planning" and "The trip needs careful planning" can be considered a parallel corpus. This parallel corpus is a Chinese-English parallel language pair. The source text "This trip needs careful planning" can be considered the source data of this parallel corpus, and the target text "The trip needs careful planning" can be considered the target data of this parallel corpus. In this case, "travel" can correspond to "trip."

[0117] In addition, “This trip requires careful planning” can be regarded as a monolingual corpus, and “The trip needs careful planning” can also be regarded as a monolingual corpus.

[0118] After collecting the training data, the data collection device 560 stores the training data in the database 530 , and the training device 520 obtains the target model / rule 501 through training based on the training data maintained in the database 530 .

[0119] Among them, the training device 520 trains the pretrained language model (PLM) in the embodiment of the present application based on the training data maintained in the database 530 to obtain the target model / rule 501.

[0120] In order to adapt to downstream tasks, the training device 520 can fine-tune the trained pre-trained language model based on the training data maintained in the database 530 to obtain the target model / rule 501.

[0121] It should be understood that the training device 520 for training the pre-trained language model and the training device 520 for fine-tuning the trained pre-trained language model may be different devices.

[0122] It should be noted that, in actual applications, the training data maintained in the database 530 may not all be collected by the data acquisition device 560, but may also be received from other devices. It should also be noted that the training device 520 may not train the target model / rule 501 entirely based on the training data maintained by the database 530, but may also obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.

[0123] The target model / rule 501 trained by the training device 520 can be applied to various systems or devices, such as the execution device 510 shown in FIG3b . The execution device 510 can be a terminal such as a mobile phone, tablet computer, laptop computer, augmented reality (AR) / virtual reality (VR) device, in-vehicle terminal, etc., or a server or cloud. In FIG3b , the execution device 510 is configured with an input / output (I / O) interface 512 for data exchange with external devices. A user can input data into the I / O interface 512 through a client device 540 .

[0124] Preprocessing module 513 and preprocessing module 514 are used to perform preprocessing based on the input data received by I / O interface 512 (for example, obtaining the positions of known data units and data units to be predicted in the target data, or generating attention information, etc.). It should be understood that preprocessing module 513 and preprocessing module 514 may be absent or there may be only one preprocessing module. When preprocessing module 513 and preprocessing module 514 are not present, computing module 511 may be used directly to process the input data.

[0125] When the execution device 510 preprocesses the input data, or when the computing module 511 of the execution device 510 performs calculations and other related processing, the execution device 510 can call the data, code, etc. in the data storage system 550 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 550.

[0126] Finally, the I / O interface 512 presents the processed results to the client device 540 so as to be provided to the user.

[0127] In the scenario shown in FIG3b , the user can manually input data, and this "manual input data" can be operated through the interface provided by I / O interface 512. In another scenario, client device 540 can automatically send input data to I / O interface 512. If user authorization is required for client device 540 to automatically send input data, the user can set the corresponding permissions in client device 540. The user can view the results output by execution device 510 on client device 540, and the specific presentation form can be a display, sound, action, or other specific methods. Client device 540 can also serve as a data acquisition terminal, collecting input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data, and storing them in database 530. Of course, collection can also be performed without client device 540, and instead the I / O interface 512 directly stores the input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data in database 530.

[0128] It is worth noting that Figure 3b is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 3b, the data storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510.

[0129] It should be understood that the execution device 510 may also be deployed in the client device 540 .

[0130] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.

[0131] (1) Neural Network

[0132] A neural network can be composed of neural units. A neural unit can refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input. The output of the operation unit can be:

[0133] Where s = 1, 2, ... n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal of the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.

[0134] (2) Transformer layer

[0135] Referring to FIG5 , FIG5 is a schematic diagram of the architecture of a transformer layer. As shown in FIG5 , the neural network includes an embedding layer and at least one transformer layer. The at least one transformer layer can be N transformer layers (N is an integer greater than 0), wherein each transformer layer includes an attention layer, an add & norm layer, a feed forward layer, and an add & normalization layer that are adjacent in sequence. In the embedding layer, the current input is embedded to obtain multiple embedding vectors; in the attention layer, P input vectors are obtained from the previous layer of the first transformer layer, and with any first input vector among the P input vectors as the center, based on the correlation between each input vector within a preset attention window and the first input vector, the intermediate vector corresponding to the first input vector is obtained, thereby determining the P intermediate vectors corresponding to the P input vectors; in the pooling layer, the P intermediate vectors are merged into Q output vectors, wherein the multiple output vectors obtained by the last transformer layer in the transformer layer are used as feature representations of the current input.

[0136] (3) Attention mechanism

[0137] The attention mechanism mimics the internal process of biological observation behavior, namely, a mechanism that aligns internal experience and external sensations to increase the observation precision of certain areas. It can quickly filter out high-value information from a large amount of information using limited attention resources. The attention mechanism can quickly extract important features from sparse data and is therefore widely used in natural language processing tasks, especially machine translation. The self-attention mechanism is an improvement on the attention mechanism, which reduces dependence on external information and is better at capturing the internal correlation of data or features. The essential idea of ​​the attention mechanism can be rewritten as the following formula:

[0138] Here, Lx = ||Source|| represents the length of the Source. This formula implies that the elements in the Source are imagined to consist of a series of data pairs. Given a Query element in the target, the similarity or correlation between the Query and each Key is calculated to obtain the weight coefficient for each Key's corresponding Value. The weighted sum of the Values ​​is then taken to obtain the final Attention value. Essentially, the Attention mechanism performs a weighted sum of the Values ​​of the Source elements, with the Query and Key used to calculate the weight coefficient for the corresponding Value. Conceptually, Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on this important information, while ignoring the majority of less important information. This focusing process is reflected in the calculation of the weight coefficients: the larger the weight, the more focus is placed on the corresponding Value. In other words, the weight represents the importance of the information, while the Value represents the corresponding information. The self-attention mechanism can be understood as internal attention. The attention mechanism occurs between the Target element Query and all elements in the Source. The self-attention mechanism refers to the attention mechanism that occurs between the internal elements of the Source or the internal elements of the Target. It can also be understood as the attention calculation mechanism in the special case of Target = Source. The specific calculation process is the same, only the calculation object changes.

[0139] (4) Natural language processing (NLP)

[0140] Natural language refers to human language, and natural language processing (NLP) is the processing of human language. Natural language processing is the process of systematically analyzing, understanding, and extracting information from text data in an intelligent and efficient manner. By using NLP and its components, it is possible to manage very large amounts of text data, perform a large number of automated tasks, and solve a wide variety of problems, such as automatic summarization, machine translation (MT), named entity recognition (NER), relation extraction (RE), information extraction (IE), sentiment analysis, speech recognition, question answering, and topic segmentation.

[0141] (5) Pre-trained language model (PLM)

[0142] A pretrained language model is a natural language sequence encoder that encodes each word in a natural language sequence into a vector representation for prediction. Its training consists of two phases. In the pre-training phase, the model is trained on a large amount of unsupervised text for language modeling tasks, thereby learning a word representation. In the fine-tuning phase, the model is initialized using the parameters learned in the pre-training phase and trained in a relatively short number of steps on downstream tasks such as text classification and sequence labeling. This allows the semantic information gained from pre-training to be successfully transferred to downstream tasks.

[0143] With the rapid development of natural language processing technology, language models have been widely applied in various natural language processing tasks, such as sentiment classification, question answering, and sequence labeling. In actual deployment and use of language models, people typically use an online inference service process. This process is as follows: a request queue waits for user queries to be submitted. After the request queue collects user queries, the controller module (scheduler) reads the queries and passes them to the language model. The language model processes the user input and returns the output to the user. Online inference services for language models have very high response speed requirements, which is also closely related to the actual user experience.

[0144] In existing implementations, the text in user input requests varies in length, and the computing chips used for online inference often have difficulty processing dynamic-length input. Therefore, it is necessary to pad the user requests to a fixed length and input the corresponding character strings into the language model in sequence, resulting in low processing efficiency.

[0145] In order to solve the above problems, an embodiment of the present application provides a data processing method.

[0146] 6A , which is a schematic diagram of an embodiment of a data processing method provided in an embodiment of the present application, can be applied to the training device or execution device described above. Specifically, the data processing method can be applied to terminal devices such as mobile phones, tablets, laptops, smart wearable devices, or to cloud-side servers. As shown in FIG6A , the data processing method provided in an embodiment of the present application includes:

[0147] 601. Acquire multiple first character strings; different first character strings correspond to different user requests.

[0148] In some scenarios, a user request may indicate a natural language processing task. For example, a user request may indicate a sequence conversion task between different language types, such as a text translation task or a summary generation task between different languages. In this case, the first string may be text in one language type. The language type may also be referred to as the language.

[0149] For example, in a Chinese-English translation task, the original text is "This trip requires careful planning", the user request may indicate that the original text is to be translated into English, and the first character string may be the original text "This trip requires careful planning".

[0150] For example, in an English-German translation task, the original text is “We danse on the grass”, the user request may indicate that the original text should be translated into German, and the first character string may be the original text “We danse on the grass”.

[0151] For example, in a summary generation task, the first character string may be the source corpus, that is, the source corpus from which a summary needs to be extracted, and the user request may instruct to generate a summary text corresponding to the source corpus.

[0152] For example, in a text reply task, the first character string may be the source corpus, that is, the source corpus from which a summary needs to be extracted, and the user request may instruct to generate reply content corresponding to the source corpus.

[0153] In one possible implementation, the multiple first character strings may represent multiple user requests received by the system from at least one user, each of which may include a first character string. The language model needs to generate a processing result corresponding to each first character string and return it to the terminal device of the user corresponding to the user request (or, if the language model is deployed on the terminal side, the processing result can be directly presented to the user).

[0154] In a possible implementation, the multiple first character strings may be character strings corresponding to user requests received within a certain time period.

[0155] In a possible implementation, the multiple first character strings may be character strings corresponding to a preset number of user requests (eg, 30) received within a certain time period.

[0156] 602. Concatenate the multiple first character strings into first input data; the first input data includes multiple vectors of the same length, each of the vectors includes at least one first character string, the length of each vector is a preset fixed length, and the number of vectors included in the first input data is a preset fixed number, wherein at least one of the vectors includes characters that do not belong to the multiple first character strings and are used to complete the length of the vector to the fixed size.

[0157] In a possible implementation, multiple first character strings can be concatenated into first input data that meets preset conditions. The first input data can be used as a whole as one-time input data to the language model, and the language model can process the first input data as a whole.

[0158] The phrase "data inputted into the language model as a whole at one time" here can be understood as not processing a first string to obtain a result and then processing the next first string, but rather inputting the first input data as a whole into the language model.

[0159] Next, we will introduce how to concatenate multiple first strings:

[0160] In one possible implementation, multiple first character strings can be concatenated into multiple vectors (for the convenience of description, vectors may also be referred to as sequences in the embodiment of the present application). The lengths of different vectors are the same (multiple vectors of the same length can be stacked into a matrix). Each vector may include at least one first character string. Since the length of the first character string is not fixed, the vectors that only include the first character string cannot be guaranteed to have strictly the same length. Therefore, some vectors can be supplemented with characters, for example, some preset characters can be used to supplement the vectors.

[0161] The length of each vector must be fixed, that is, the length of the vector must be consistent across different concatenation processes. Furthermore, the number of vectors included in each concatenation result (e.g., the first input data and the second input data described later) must be fixed, that is, the number of vectors included in each concatenation result must be consistent across different concatenation processes. This ensures that the concatenation result remains fixed in both dimensions.

[0162] Computing chips for online inference have difficulty processing dynamic-length inputs. In the embodiments of the present application, the size of the input data input to the language model each time is guaranteed to remain statically consistent. The input data is obtained by concatenating strings based on multiple user requests, so that the language model can process multiple user requests at a time, thereby improving processing efficiency.

[0163] In a possible implementation, multiple second character strings may be obtained; the second character strings and the first character string correspond to different user requests, and different second character strings correspond to different user requests; the multiple second character strings are processed into second input data; the second input data and the first input data have the same size; and the first input data as a whole is input into the language model as one input data.

[0164] Since inference chips often only support static shapes, in order to ensure the affinity of the spliced ​​data to the inference hardware, the embodiment of the present application sets the output of the blocking queue to data of a fixed batch size, thereby maintaining staticity in the dimension of batch size.

[0165] In order to speed up the reasoning speed, the embodiment of the present application can adopt a greedy splicing method with the shortest data first, that is, under the premise of not exceeding the preset length, the shortest data that can be spliced ​​at present is added to the longest data that has been spliced. A flow chart of the specific algorithm is as follows: the static sequence length (that is, the maximum number of strings included in each vector) is pre-set to M, and all data to be spliced ​​are sorted in descending order by length, and traversed from top to bottom by length. If the data to be spliced ​​still does not exceed the static preset length (optionally, the spliced ​​data does not exceed the number M that can be accommodated), it is spliced ​​with the shortest data currently available. Otherwise, no splicing is performed and the next data is checked. For each sequence, the spliced ​​data can be padded to reach the preset static sequence length.

[0166] Taking the first character string to be spliced ​​as the first target character string as an example, in a possible implementation, multiple first characters other than the first target character string among the multiple first characters (for example, some first characters other than the first target character string among the multiple first characters, depending on the splicing progress) can be spliced ​​to obtain M vectors (the M vectors can be vectors that have not yet been completed), and the first target character string is spliced ​​to a target vector among the M vectors to obtain a spliced ​​target vector, where the target vector is the shortest vector among the M vectors, and the length of the spliced ​​target vector is less than or equal to the fixed length.

[0167] In a possible implementation, the number of first character strings included in each of the multiple vectors with the same length is smaller than a threshold.

[0168] It adopts the shortest data first splicing scheme and uses the greedy method to splice according to the data length. It has a fast splicing speed and is suitable for streaming data input in online services.

[0169] In a possible implementation, multiple second character strings can also be obtained, and the acquisition time of the user request corresponding to the second character string is later than the acquisition time of the user request corresponding to the second character string; after the multiple first character strings are processed into the first input data, the first input data can be stored in a first-in-first-out queue; based on sufficient storage space of the first-in-first-out queue, the multiple second character strings can be processed into the second input data.

[0170] Furthermore, in a possible implementation, based on the language model being in an idle state, the first input data stored in the first-in-first-out queue may be input into the language model.

[0171] As shown in Figure 6B, the data splicer can be set up as a producer, temporarily storing the spliced ​​data in a blocking queue. The language model can be set up as a consumer, reading data from the blocking queue and performing inference. This solution is suitable for scenarios where online services are unevenly populated: when the blocking queue is full, a full signal is sent to the data splicer, pausing it; when the blocking queue is empty, an empty signal is sent to the model, pausing inference.

[0172] Online stitching uses a producer-consumer model, suitable for scenarios where online services experience uneven workloads. It ensures static inference dimensions and is compatible with inference hardware. Using the SQuAD 1.0 reading comprehension task as an example, this approach can directly achieve a 47% to 74% inference acceleration.

[0173] 603. Take the first input data as a whole as input data and input it into the language model.

[0174] In one possible implementation, the language model may include an embedding layer, a feature extraction network, and a task network, wherein the feature extraction network may be a network implemented based on a transformer.

[0175] In one possible implementation, the language model may include an embedding layer, which can embed input data. This embedding layer can be referred to as an input embedding layer. After receiving the current input, the embedding layer can embed each data unit in the current input to obtain an embedding vector corresponding to each data unit.

[0176] In some embodiments, the position information (or position vector) of each data unit in the data unit can also be obtained. The position vector is used to indicate the position of each data unit in the data sequence. Specifically, the position information can be used to indicate the relative position relationship between each data unit in the data unit and other data units.

[0177] In one possible implementation, the embedding layer may include an input embedding layer and a positional encoding layer. In the input embedding layer, word embedding processing may be performed on each data unit in the current input to obtain a word vector for each data unit (e.g., which may represent semantic information). In the positional encoding layer, the position of each data unit in the current input may be obtained, and a position vector may be generated for each data unit.

[0178] In some examples, the position information of each data unit in the data sequence can be the absolute position of each data unit in the data sequence. For example, taking the current input "Which number should I repay Huabei by?", the position of "how many" can be represented as the first digit, the position of "number" can be represented as the second digit, and so on. In some examples, the position of each data unit in the data sequence can be the relative position of each data unit in the data sequence. Still taking the current input "Which number should I repay Huabei by?" as an example, the position of "how many" can be represented as before "number," the position of "number" can be represented as after "how many" and before "should," and so on. After obtaining the word vector and position vector for each data unit in the current input, the position vector and the corresponding word vector of each data unit can be fused to obtain an embedding vector for each data unit. It should be understood that the fusion method can be to add the position vector and the corresponding word vector, or to perform other operations, and the specific fusion method is not limited here. The embedding vector can be represented as an embedding matrix with a preset dimension. The number of embedding vectors can be set to M, and the preset dimension can be set to H. The embedding vector can then be represented as an M×H embedding matrix.

[0179] In one possible implementation, because the first input data includes multiple first character strings, and different character strings correspond to different user requests, it is necessary to distinguish between the different character strings during position encoding. Specifically, the first input data as a whole can be input into a language model as a single input data, along with position information corresponding to the first input data. The position information indicates the position of each character unit in the multiple first character strings within the first input data, as well as the first character string to which each character unit belongs. The position embedding layer in the language model can perform position encoding based on the input position information.

[0180] For example, for position coding, the position codes of multiple spliced ​​data can be concatenated accordingly, that is, the position code of each new data starts at 0; if the spliced ​​data does not reach the preset length, it is padded with a preset character (such as [pad]). Referring to Figure 7, Figure 7 is a schematic diagram of position information.

[0181] In one possible implementation, the language model may further include multiple transformer layers in series. Each transformer layer may process the data output by the previous transformer layer adjacent to the transformer layer to obtain an intermediate vector, and output the intermediate vector to the next transformer layer adjacent to the transformer layer; wherein, if the transformer layer is the transformer layer closest to the input side among the multiple transformer layers, the input data of the transformer layer is the embedded vector; if the transformer layer is the transformer layer closest to the output side among the multiple transformer layers, the data output by the transformer layer is the hidden state.

[0182] The core feature of the transformer layer lies in its unique attention mechanism. When processing natural language, such as a sentence, the transformer model uses this attention mechanism to assign different attention coefficients to the embedding vectors of each word in the sentence, thereby more comprehensively considering the impact of the context in the sentence on each word. A specific transformer layer may include a multi-head attention layer, an add and normalization layer, a feed forward layer, and an add and normalization layer, which are adjacent to each other. Among them, the attention layer is connected to the embedding layer, obtains the embedding vector from the embedding layer as the input vector, and synthesizes each embedding vector based on the correlation between each embedding vector in the embedding vector to obtain the output vector, which is output to the subsequent transformer layer. The transformer layer obtains the output of the previous layer as the input vector and performs operations similar to those of the previous transformer layer.

[0183] Refer to Figure 6C, which is a schematic diagram of the structure of a transformer layer. Each transformer layer in the embodiment of the present application can refer to the structure shown in Figure 6C. As shown in Figure 6C, the transformer layer includes a multi-head attention layer, an add and normalization layer, a feed forward layer, and an add and normalization layer that are adjacent in sequence.

[0184] Among them, the multi-head attention layer obtains M input vectors X from its previous layer l , which can also be expressed as a matrix X. Using the self-attention mechanism, each vector is transformed based on the correlation between the vectors to obtain M output vectors, which can also be expressed as a matrix Y. It can be understood that when the multi-head attention layer is a layer directly connected to the embedding layer, the input vector it obtains is the embedding vector output by the embedding layer; when the multi-head attention layer is a multi-head attention layer included in the subsequent transformer layer, the input vector it obtains is the output vector of the previous transformer layer. In the multi-head attention layer, the MHA layer based on multi-head attention (MHA) includes multiple attention heads (such as Head 1, Head 2, ..., Head N shown in Figure 6C).

[0185] FIG6D is a schematic diagram of the operation of an attention head, which shows how the attention head transforms the input matrix X into the output matrix Y. As shown in FIG6D , the first transformation matrix Q, the second transformation matrix K and the third transformation matrix V are used to transform the M input vectors<X1,X2,…,XN> Each input vector Xi is transformed to obtain the first intermediate vector (q vector), the second intermediate vector (k vector) and the third intermediate vector (v vector) corresponding to each input vector. Operationally, the first transformation matrix Q, the second transformation matrix K and the third transformation matrix V can be used to perform linear transformation on the input matrix X composed of N input vectors, respectively, to obtain the Q matrix, the K matrix and the V matrix of the input matrix, and then the matrix is ​​split respectively to obtain the q vector, the k vector and the v vector corresponding to each input vector. For any i-th input vector Xi among the M input vectors, based on the dot product operation of the first intermediate vector (q vector, qi) corresponding to the i-th input vector and the second intermediate vector (k vector, kj) corresponding to each input vector Xj, the respective correlation degrees of the i-th input vector Xi and each input vector Xj are determined. Although the dot product result of qi and kj can also be directly determined as the correlation degree, it is more classic to first divide the dot product result by a constant, and then perform a softmax operation, and use the result of the operation as the correlation degree between the input vector Xi and Xj, that is:

[0186] Therefore, the correlation degrees αi,j between the i-th input vector Xi and each input vector Xj can be used as weight factors to perform a weighted combination on the third intermediate vectors (v vectors, vj) corresponding to each input vector Xj to obtain the i-th combination vector Ci corresponding to the i-th input vector Xi:

[0187] Thus, we can get the vector sequence of M combination vectors corresponding to M input vectors<C1,C2,…,CN> , or matrix C. Based on this combination vector sequence, M output vectors can be obtained. Specifically, in one embodiment, the vector sequence of N combination vectors can be directly used as M output vectors, that is, Yi=Ci. At this time, the output matrix Y is the combination vector matrix C, which can also be written as:

[0188] The above is a description of the processing of an attention head. In the MHA architecture, the MHA layer maintains m sets of transformation matrices. Each set of transformation matrices includes the aforementioned first transformation matrix Q, second transformation matrix K, and third transformation matrix V, so that the above operations can be performed in parallel to obtain m combination vector sequences (i.e., m matrices C). Each vector sequence includes N combination vectors obtained based on a set of transformation matrices. In this case, the MHA layer splices the obtained m combination vector sequences to obtain a spliced ​​matrix; then transforms the spliced ​​matrix through the fourth transformation matrix W to obtain the final output matrix Y. Splitting the output matrix Y corresponds to the M output vectors<Y1,Y2,…,YN> Through the above operation process, the MHA layer performs transformation operations based on the correlation between N input vectors to obtain M output vectors.

[0189] In one possible implementation, because the first input data includes multiple first character strings, and different character strings correspond to different user requests, it is necessary to distinguish the different character strings during feature extraction, and to ensure that the processing processes are independent of each other. When performing attention calculations, there is no interaction between the different first character strings. Specifically, the first input data can be processed by the language model; the language model includes an attention module, which is configured to perform an attention operation on the first input data based on attention information, and the attention information indicates that when performing the attention operation, there is no attention interaction between the different first character strings in the first input data.

[0190] In one possible implementation, the attention information is a block diagonal matrix.

[0191] For example, when calculating the self-attention matrix for the concatenated data, it is necessary to ensure the independence of different data. Therefore, a mask matrix (attention mask) can be set to convert the original matrix into a block diagonal matrix. Each data item can only interact with words within the data item, and data items are invisible to each other. Refer to Figure 8, which shows a schematic diagram of a block diagonal matrix.

[0192] Similar to the positional encoding changes, the hidden states of the concatenated data output can be processed separately. For example, referring to Figure 9, in a classification problem, the [CLS] token of each data item can be taken for subsequent operations.

[0193] In addition, the model output needs to be unstitched. For multiple data items spliced ​​into a sequence, it is necessary to understand the number of each data item and its starting and ending positions in the spliced ​​data so that the output can be mapped to the original data.

[0194] In a possible implementation, the first input data can be processed by the language model to obtain a processing result corresponding to the first input data; and the processing result can be split into multiple sub-processing results based on the location information, each sub-processing result corresponding to one of the user requests.

[0195] For certain applications (such as document question answering), it is also necessary to know additional attributes of each data piece, such as the article ID, document sliding window number, etc., so that multiple sliding windows with the same article ID or document can be merged.

[0196] An embodiment of the present application provides a data processing method, the method comprising: obtaining multiple first character strings; different first character strings correspond to different user requests; concatenating the multiple first character strings into first input data; the first input data comprises multiple vectors of the same length, each of the vectors comprises at least one first character string, the length of each vector is a preset fixed length, the number of vectors included in the first input data is a preset fixed number, wherein at least one of the vectors comprises characters that do not belong to the multiple first character strings and are used to complete the length of the vector to the fixed size; the first input data as a whole is input as one input data to the language model. Through the above method, it is ensured that the size of the input data input to the language model each time remains statically consistent, and the input data is obtained by concatenating the character strings based on multiple user requests, so that the language model can process multiple user requests at one time, thereby improving processing efficiency.

[0197] The embodiment of the present application can be applied to the online model inference service on the cloud service side, and is suitable for a series of Transformer-based natural language processing models such as BERT. A schematic diagram of the online inference system architecture corresponding to the embodiment of the present application can be shown in Figure 10. The system architecture collects user queries through a request queue, and then hands it over to the splicer module to splice the data in real time. After the splicing is completed, the spliced ​​data is passed to the blocking queue. The blocking queue will input the data into the model for inference when the inference model is idle. Finally, the model will return the output to the user based on the user ID.

[0198] Referring to Figure 11 , the data splicing acceleration solution proposed in this embodiment can be used in natural language processing cloud services to help users accelerate their given or specified Transformer-based models. This technology supports various natural language processing tasks such as sentiment classification, entity recognition, sequence labeling, translation, text clustering, keyword extraction, public opinion analysis, and summary extraction.

[0199] The embodiment of the present application can also be used to accelerate local model reasoning on terminal devices (such as mobile phones, computers, and watches). Usually, the computing power of terminal devices is limited, and they have to take into account multiple other programs running in real time, and they are often unable to respond to user requests in a timely manner. Using the embodiment of the present application, direct splicing can be performed on the user's local data to speed up model reasoning. If the data to be inferred is known, the streaming data in the non-cloud service can be directly spliced ​​offline, which often achieves better splicing efficiency and thus achieves a greater acceleration ratio.

[0200] To verify the speedup of online data splicing, we measured inference speed using the BERT-base model using the SQuAD 1.0 dataset as an example. The SQuAD 1.0 dataset contains 10,833 publicly available data points, simulating the streaming data input of an online service. We tested the speed gains at different inference batch sizes. We also used offline data splicing as a comparison algorithm, with the results shown in Table 1. We found that as the batch size of the inference service increases, the speedup of both offline and online data splicing improves to varying degrees compared to the original approach. This is because larger batch sizes allow for better utilization of the computational performance of the inference service chip, as expected. Furthermore, as batch size increases, the online data splicing solution has more candidate data to splice with, thereby optimizing the splicing strategy, resulting in less sequence data and directly reducing inference costs.

[0201] Table 1

[0202] In addition to measuring the speedup ratio, we also measured the inference performance of the model after data splicing. As shown in Table 2, the inference model's EM and F1 scores on the SQuAD 1.0 dataset remained consistent across different input batch sizes, with varying degrees of speedup. This demonstrates that the data splicing solution for online inference does not compromise task performance.

[0203] Table 2

[0204] To verify the effectiveness of the shortest data-first greedy splicing described above, we calculated the token efficiency (token eff), which is the proportion of real data tokens in a spliced ​​sample; the pack rate (pack rate), which is the ratio of the number of samples in the original dataset to the number of samples in the spliced ​​data; and the number of samples after online data splicing (#samples). As shown in Table 3, as the batch size (bsz) increases, the token efficiency, pack rate, and number of samples for online data splicing all improve significantly. When bsz is increased to 128, all sample splicing metrics approach those of offline splicing.

[0205] Table 3

[0206] Next, we demonstrate the speed advantage of shortest data-first splicing. Generally speaking, a reasonable balance needs to be struck between data splicing and model forward inference time, and it should not be slower than model inference time. Otherwise, the bottleneck of the entire inference system will be limited by data splicing. As shown in Table 4, the least squares data splicing consumes a considerable amount of time. When the batch size is small, it can even take three times as long as the model forward inference time. In contrast, the shortest data-first splicing solution only takes a few to tens of milliseconds, which is tens to hundreds of times faster than least squares splicing and far less than the model forward inference time.

[0207] Table 4

[0208] On the basis of the embodiments corresponding to Figures 1 to 11, in order to better implement the above-mentioned solutions of the embodiments of the present application, the following also provides related devices for implementing the above-mentioned solutions. Specifically, refer to Figure 12, which is a structural schematic diagram of a data processing device 1200 provided in an embodiment of the present application. The data processing device 1200 can be a terminal device or a server, and the data processing device 1200 can include:

[0209] An acquisition module 1201 is configured to acquire multiple first character strings, wherein different first character strings correspond to different user requests;

[0210] The specific description of the acquisition module 1201 can refer to the description of step 601 in the above embodiment, which will not be repeated here.

[0211] Processing module 1202 is configured to concatenate the multiple first character strings into first input data; the first input data includes multiple vectors of the same length, each vector includes at least one first character string, the length of each vector is a preset fixed length, and the number of vectors included in the first input data is a preset fixed number, wherein at least one vector includes a character that does not belong to the multiple first character strings and is used to complete the length of the vector to the fixed length;

[0212] The first input data as a whole is taken as input data and input into the language model.

[0213] The specific description of the processing module 1202 can refer to the description of step 602 and step 603 in the above embodiment, which will not be repeated here.

[0214] In a possible implementation, the acquisition module is further configured to:

[0215] Acquire multiple second character strings; the second character strings and the first character string correspond to different user requests, and different second character strings correspond to different user requests;

[0216] Processing the plurality of second character strings as second input data; wherein the second input data has the same size as the first input data;

[0217] The first input data as a whole is taken as input data and input into the language model.

[0218] In a possible implementation, the acquisition time of the user request corresponding to the second character string is later than the acquisition time of the user request corresponding to the second character string;

[0219] The processing module is further configured to:

[0220] After processing the plurality of first character strings into first input data, storing the first input data in a first-in-first-out queue;

[0221] The processing module is specifically used to:

[0222] Based on the storage space of the first-in-first-out queue being sufficient, the plurality of second character strings are processed as second input data.

[0223] In a possible implementation, the processing module is specifically configured to:

[0224] Based on the language model being in an idle state, first input data stored in the first-in-first-out queue is input into the language model.

[0225] In a possible implementation, the multiple first character strings include a first target character string; and the processing module is specifically configured to:

[0226] splicing multiple first character strings excluding the first target character string from the multiple first character strings to obtain M vectors;

[0227] The first target character string is concatenated to a target vector in the M vectors to obtain a concatenated target vector, where the target vector is the shortest vector in the M vectors, and the length of the concatenated target vector is less than or equal to the fixed length.

[0228] In a possible implementation, the number of first character strings included in each of the multiple vectors with the same length is smaller than a threshold.

[0229] In a possible implementation, the processing module is specifically configured to:

[0230] The first input data as a whole is taken as an input data and the position information corresponding to the first input data is input into the language model; the position information is used to indicate the position information of each character unit in the multiple first character strings in the first input data, and the first character string to which each character unit belongs.

[0231] In a possible implementation, the processing module is further configured to:

[0232] Processing the first input data using the language model to obtain a processing result corresponding to the first input data;

[0233] The processing result is split into multiple sub-processing results according to the location information, and each sub-processing result corresponds to one of the user requests.

[0234] In a possible implementation, the processing module is further configured to:

[0235] The first input data is processed by the language model; the language model includes an attention module, which is used to perform an attention operation on the first input data based on attention information, and the attention information indicates that when performing the attention operation, there is no attention interaction between different first character strings in the first input data.

[0236] In one possible implementation, the attention information is a block diagonal matrix.

[0237] Next, an execution device provided in an embodiment of the present application is introduced. Please refer to Figure 13. Figure 13 is a structural diagram of an execution device provided in an embodiment of the present application. The execution device 1300 can be specifically manifested as a virtual reality VR device, a mobile phone, a tablet, a laptop computer, a smart wearable device, a monitoring data processing device or a server, etc., which is not limited here. Specifically, the execution device 1300 includes: a receiver 1301, a transmitter 1302, a processor 1303 and a memory 1304 (wherein the number of processors 1303 in the execution device 1300 can be one or more, and Figure 13 takes one processor as an example), wherein the processor 1303 may include an application processor 13031 and a communication processor 13032. In some embodiments of the present application, the receiver 1301, the transmitter 1302, the processor 1303 and the memory 1304 may be connected via a bus or other means.

[0238] Memory 1304 may include read-only memory and random access memory, and provides instructions and data to processor 1303. A portion of memory 1304 may also include non-volatile random access memory (NVRAM). Memory 1304 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.

[0239] Processor 1303 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.

[0240] The methods disclosed in the above embodiments of the present application can be applied to or implemented by processor 1303. Processor 1303 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in processor 1303. The above processor 1303 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 1303 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in conjunction with the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 1304, and processor 1303 reads the information in memory 1304 and, in conjunction with its hardware, completes the steps of the above method.

[0241] Receiver 1301 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 1302 can be used to output digital or character information through the first interface. Transmitter 1302 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 1302 can also include a display device such as a display screen.

[0242] The present application also provides a training device. Please refer to FIG. 14 , which is a schematic diagram of a structure of a training device provided by an embodiment of the present application. Specifically, the training device 1400 is implemented by one or more servers. The training device 1400 may vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1414 (e.g., one or more processors), a memory 1432, and one or more storage media 1430 (e.g., one or more mass storage devices) storing application programs 1442 or data 1444. The memory 1432 and storage medium 1430 may be either ephemeral or persistent storage. The program stored in the storage medium 1430 may include one or more modules (not shown), each of which may include a series of instruction operations on the training device. Furthermore, the CPU 1414 may be configured to communicate with the storage medium 1430 to execute the series of instruction operations in the storage medium 1430 on the training device 1400.

[0243] The training device 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input and output interfaces 1458; or, one or more operating systems 1441, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0244] In the embodiment of the present application, the central processing unit 1414 is used to execute the data processing method described in the embodiment corresponding to Figure 6A.

[0245] An embodiment of the present application also provides a computer program product, which, when running on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

[0246] A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

[0247] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the model training method described in the above embodiment, or so that the chip in the training device executes the model training method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0248] Specifically, please refer to Figure 15, which is a structural diagram of a chip provided in an embodiment of the present application. The data processing method described in the embodiment corresponding to Figure 6A above can be implemented in the chip shown in Figure 15. Specifically, the chip can be expressed as a neural network processor NPU 1500, which is mounted on the main CPU (Host CPU) as a coprocessor and assigned tasks by the Host CPU. The core part of the NPU is the operation circuit 1503, and the controller 1504 controls the operation circuit 1503 to extract data from the memory (weight memory or input memory) and perform operations.

[0249] Optionally, the model training method described in the embodiment corresponding to Figure 6A above can be completed by the main CPU and NPU in the chip shown in Figure 15.

[0250] In some implementations, arithmetic circuit 1503 includes multiple processing units (PEs). In some implementations, arithmetic circuit 1503 is a two-dimensional systolic array. Arithmetic circuit 1503 can also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, arithmetic circuit 1503 is a general-purpose matrix processor.

[0251] For example, assume there are input matrix A, weight matrix B, and output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from weight memory 1502 and caches it on each PE in the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from input memory 1501 and performs a matrix operation on matrix B. The partial or final matrix result is stored in accumulator 1508.

[0252] Unified memory 1506 is used to store input and output data. Weight data is directly transferred to weight memory 1502 through the Direct Memory Access Controller (DMAC) 1505. Input data is also transferred to unified memory 1506 through the DMAC.

[0253] BIU stands for Bus Interface Unit 1510 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 1509 .

[0254] The bus interface unit 1510 (BIU) is used for the instruction fetch memory 1509 to obtain instructions from the external memory, and is also used for the storage unit access controller 1505 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

[0255] DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1506 or transfer weight data to the weight memory 1502 or transfer input data to the input memory 1501.

[0256] The vector calculation unit 1507 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.

[0257] In some implementations, the vector calculation unit 1507 can store the processed output vector in the unified memory 1506. For example, the vector calculation unit 1507 can apply a linear function or a nonlinear function to the output of the operation circuit 1503, such as linear interpolation of the feature plane extracted by the convolution layer, or accumulate a vector of values ​​to generate an activation value. In some implementations, the vector calculation unit 1507 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1503, for example, for use in subsequent layers in a neural network.

[0258] An instruction fetch buffer 1509 connected to the controller 1504 is used to store instructions used by the controller 1504;

[0259] Unified memory 1506, input memory 1501, weight memory 1502, and instruction fetch memory 1509 are all on-chip memories. External memories are private to the NPU hardware architecture.

[0260] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.

[0261] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.

[0262] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.

[0263] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0264] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

Claims

1. A data processing method, characterized in that: The method comprises: Acquire multiple first character strings; different first character strings correspond to different user requests; The multiple first character strings are concatenated into first input data; the first input data includes multiple vectors of the same length, each of the vectors includes at least one first character string, the length of each vector is a preset fixed length, and the number of vectors included in the first input data is a preset fixed number, wherein at least one of the vectors includes a character that does not belong to the multiple first character strings and is used to fill the length of the vector to the fixed size; The first input data as a whole is taken as input data and input into the language model.

2. The method according to claim 1, characterized in that The method further comprises: Acquire multiple second character strings; the second character strings and the first character string correspond to different user requests, and different second character strings correspond to different user requests; Processing the plurality of second character strings as second input data; the second input data has the same size as the first input data; The first input data as a whole is taken as input data and input into the language model.

3. The method according to claim 2, characterized in that The acquisition time of the user request corresponding to the second character string is after the acquisition time of the user request corresponding to the second character string; The method further comprises: After processing the plurality of first character strings into first input data, storing the first input data in a first-in-first-out queue; The processing of the plurality of second character strings as second input data comprises: Based on the storage space of the first-in first-out queue being sufficient, the plurality of second character strings are processed as second input data.

4. The method according to claim 2 or 3, characterized in that: The step of inputting the first input data into a language model comprises: Based on the language model being in an idle state, the first input data stored in the first-in-first-out queue is input into the language model.

5. The method according to any one of claims 1 to 4, characterized in that: The plurality of first character strings include a first target character string; and the step of concatenating the plurality of first character strings into first input data includes: Concatenate multiple first character strings except the first target character string among the multiple first character strings to obtain M vectors; The first target character string is concatenated to a target vector in the M vectors to obtain a concatenated target vector, wherein the target vector is the shortest vector in the M vectors, and the length of the concatenated target vector is less than or equal to the fixed length.

6. The method according to claim 5, characterized in that The number of first character strings included in each of the plurality of vectors of the same length is smaller than a threshold.

7. The method according to any one of claims 1 to 6, characterized in that: The step of taking the first input data as a whole and inputting it into a language model comprises: The first input data as a whole is taken as an input data and the position information corresponding to the first input data is input into the language model; the position information is used to indicate the position information of each character unit in the multiple first character strings in the first input data and the first character string to which each character unit belongs.

8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Processing the first input data by using the language model to obtain a processing result corresponding to the first input data; According to the location information, the processing result is divided into multiple sub-processing results, each sub-processing result corresponds to one of the users ask.

9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: The first input data is processed by the language model; the language model includes an attention module, and the attention module is used to perform an attention operation on the first input data based on attention information, and the attention information indicates that when performing the attention operation, there is no attention interaction between different first character strings in the first input data.

10. The method according to any one of claims 1 to 9, characterized in that: The attention information is a block diagonal matrix.

11. A data processing device, characterized in that: The device comprises: An acquisition module, configured to acquire a plurality of first character strings; different first character strings correspond to different user requests; a processing module, configured to concatenate the plurality of first character strings into first input data; the first input data comprising a plurality of vectors of the same length, each of the vectors comprising at least one first character string, the length of each of the vectors being a preset fixed length, the number of vectors included in the first input data being a preset fixed number, wherein at least one of the vectors comprises a character that does not belong to the plurality of first character strings and is used to complete the length of the vector to the fixed size; The first input data as a whole is taken as input data and input into the language model.

12. The device according to claim 11, characterized in that The acquisition module is further used for: Acquire multiple second character strings; the second character strings and the first character string correspond to different user requests, and different second character strings correspond to different user requests; Processing the plurality of second character strings as second input data; the second input data has the same size as the first input data; The first input data as a whole is taken as input data and input into the language model.

13. The device according to claim 12, characterized in that The acquisition time of the user request corresponding to the second character string is after the acquisition time of the user request corresponding to the second character string; The processing module is further used for: After processing the plurality of first character strings into first input data, storing the first input data in a first-in-first-out queue; The processing module is specifically used for: Based on the storage space of the first-in first-out queue being sufficient, the plurality of second character strings are processed as second input data.

14. The device according to claim 12 or 13, characterized in that The processing module is specifically used for: Based on the language model being in an idle state, the first input data stored in the first-in-first-out queue is input into the language model.

15. The device according to any one of claims 11 to 14, characterized in that: The plurality of first character strings include a first target character string; and the processing module is specifically configured to: Concatenate multiple first character strings except the first target character string among the multiple first character strings to obtain M vectors; The first target character string is concatenated to a target vector in the M vectors to obtain a concatenated target vector, where the target vector is the shortest vector in the M vectors, and the length of the concatenated target vector is less than or equal to the fixed length.

16. The device according to claim 15, characterized in that Each of the plurality of vectors of the same length includes a number of first character strings that is smaller than a threshold.

17. The device according to any one of claims 11 to 16, characterized in that The processing module is specifically used for: The first input data as a whole is taken as input data and position information corresponding to the first input data is input into the language model; the position information is used to indicate the position information of each character unit in the plurality of first character strings in the first input data, and the first string to which each character unit belongs.

18. The device according to any one of claims 11 to 17, characterized in that The processing module is further used for: Processing the first input data by using the language model to obtain a processing result corresponding to the first input data; According to the location information, the processing result is split into a plurality of sub-processing results, each sub-processing result corresponding to one of the user requests.

19. The device according to any one of claims 11 to 18, characterized in that The processing module is further used for: The first input data is processed by the language model; the language model includes an attention module, and the attention module is used to perform an attention operation on the first input data based on attention information, and the attention information indicates that when performing the attention operation, there is no attention interaction between different first character strings in the first input data.

20. The device according to any one of claims 11 to 19, characterized in that The attention information is a block diagonal matrix.

21. A data processing device, characterized in that: The device includes a memory and a processor; the memory stores codes, and the processor is configured to obtain the codes and execute the method according to any one of claims 1 to 10.

22. A computer storage medium, characterized in that The computer storage medium stores one or more instructions, which, when executed by one or more computers, enable the one or more computers to implement the method of any one of claims 1 to 10.

23. A computer program product, characterized in that The computer program product comprises codes for implementing the steps of the method according to any one of claims 1 to 10 when the codes are executed.

Citation Information

Patent Citations

  • Natural language correction method and system, equipment and storage medium

    CN108647207A

  • Generating method and device, training method and device, computer readable medium and electronic equipment

    CN108920560A

  • Data processing method and related equipment

    CN115221846A

  • Answer generation method and device, equipment and storage medium

    CN115730586A

  • Data processing method and related equipment

    CN116541492A

Cited By

  • Character string expression generation method and device, training method and device, equipment and medium

    CN119720949A

  • Large model data processing method and device, equipment and medium

    CN121029652A

  • Data processing method and device of large model, equipment and medium

    CN121029652B