Data processing method and apparatus

By adding updateable weighting factors during the fine-tuning process of the neural network model and not updating during pre-training, the problem of high model fine-tuning costs in the existing technology is solved, and the cost reduction and efficiency improvement are achieved while ensuring accuracy. Effect.

WO2024213099A1PCT designated stage expired Publication Date: 2024-10-17HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/087431
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-14
Filing Date
2024-04-12
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

In the existing technology, a large number of parameters need to be adjusted during the fine-tuning process of the neural network model, resulting in high costs. There is an urgent need for a low-cost model fine-tuning method.

Method used

During the fine-tuning process of the neural network model, add updateable weighting factors after the linear transformation layer, and do not update or include these weighting factors during pre-training to reduce the number of other model parameters, thereby reducing the cost of fine-tuning.

Benefits of technology

While ensuring model accuracy, the cost of model fine-tuning is reduced, training speed and storage efficiency are improved, making fine-tuning of large pre-trained models on data in specific fields more efficient.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024087431_17102024_PF_FP_ABST
    Figure CN2024087431_17102024_PF_FP_ABST
Patent Text Reader

Abstract

A data processing method, which is applied to the field of artificial intelligence. The method comprises: acquiring data to be processed; according to a neural network model, processing said data to obtain a processing result, wherein the neural network model comprises a linear transformation layer and a weighting factor corresponding to the linear transformation layer, and when said data is processed, the neural network model is used for fusing an output of the linear transformation layer with the corresponding weighting factor; and determining a loss according to the processing result, and updating the weighting factor in the neural network model according to the loss, so as to obtain a fine-tuned neural network model. In this way, when fine tuning for a neural network model is performed, an updatable weighting factor is added behind a linear transformation layer, such that the number of other updated model parameters can be reduced when the precision of the fine-tuned model is ensured, thereby reducing the cost for the fine tuning of the model.
Need to check novelty before this filing date? Find Prior Art

Description

A data processing method and device thereof

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on April 14, 2023, with application number 202310416595.8 and invention name “A data processing method and device thereof”, 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 device thereof. Background Art

[0003] Artificial Intelligence (AI) is the theory, methods, techniques, 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] As neural network models continue to grow in size, they incur enormous computational and storage costs during model training and inference. Existing techniques often employ fine-tuning of pre-trained large models to adapt to downstream tasks, thereby reducing model training costs.

[0005] However, in order to ensure model accuracy, the number of parameters that need to be adjusted during fine-tuning in the existing technology is still relatively large. Therefore, a low-cost model fine-tuning method is urgently needed.

[0006] Summary of the Invention

[0007] This application provides a data processing method that can reduce the cost of model fine-tuning.

[0008] In a first aspect, the present application provides a data processing method, the method comprising: obtaining data to be processed; processing the data to be processed according to a neural network model to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer, and when processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor; determining the loss based on the processing result, and updating the weighting factor in the neural network model based on the loss to obtain a fine-tuned neural network model.

[0009] When fine-tuning a neural network model, adding an updateable weighting factor after the linear transformation layer can reduce the number of other updated model parameters while ensuring the accuracy of the fine-tuning model, thereby reducing the cost of model fine-tuning.

[0010] It should be understood that the embodiments of the present application can also be extended to integrate weighting factors after other types of network layers other than linear transformation layers in the neural network model, or within the network layer. Optionally, the weighting factor may not exist or be updated during pre-training, but participate in the update during fine-tuning.

[0011] In one possible implementation, the data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or, the data to be processed is text data, the neural network model is used to implement a natural language generation task, and the processing result is text data.

[0012] In one possible implementation, the data to be processed is image data with noise added, the neural network model includes a feature extraction network and a denoising network, the feature extraction network includes a linear transformation layer; the processing result is the denoised image data output by the denoising network; and the loss is determined based on the processing result, including: determining the loss based on the processing result and the image data before noise is added.

[0013] In one possible implementation, the neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

[0014] In one possible implementation, the neural network model includes a feature extraction network and a task network, and the feature extraction network includes a linear transformation layer.

[0015] In a possible implementation, the neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head.

[0016] In a possible implementation, the neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

[0017] In a second aspect, the present application provides a data processing method, the method comprising:

[0018] Get the data to be processed;

[0019] According to the neural network model, the data to be processed is processed to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer. When processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor.

[0020] In one possible implementation, the data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or,

[0021] The data to be processed is text data, the neural network model is used to implement the natural language generation task, and the processing result is text data.

[0022] In one possible implementation, the neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

[0023] In one possible implementation, the neural network model includes a feature extraction network and a task network, and the feature extraction network includes a linear transformation layer.

[0024] In one possible implementation, the neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

[0025] In one possible implementation, the neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head; or,

[0026] The neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

[0027] In a third aspect, the present application provides a data processing device, characterized in that the device includes:

[0028] An acquisition module is used to obtain data to be processed;

[0029] a processing module for processing the data to be processed according to the neural network model to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer. When processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor;

[0030] According to the processing results, the loss is determined, and the weighting factors in the neural network model are updated according to the loss to obtain a fine-tuned neural network model.

[0031] In one possible implementation, the data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or,

[0032] The data to be processed is text data, the neural network model is used to implement the natural language generation task, and the processing result is text data.

[0033] In one possible implementation, the data to be processed is image data with added noise, the neural network model includes a feature extraction network and a denoising network, the feature extraction network includes a linear transformation layer; the processing result is the denoised image data output by the denoising network;

[0034] Processing module, specifically used for:

[0035] The loss is determined based on the processing results and the image data before adding noise.

[0036] In one possible implementation, the neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

[0037] In one possible implementation, the neural network model includes a feature extraction network and a task network, and the feature extraction network includes a linear transformation layer.

[0038] In a possible implementation, the neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head.

[0039] In a possible implementation, the neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

[0040] In a fourth aspect, the present application provides a data processing device, comprising:

[0041] An acquisition module is used to obtain data to be processed;

[0042] According to the neural network model, the data to be processed is processed to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer. When processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor.

[0043] In one possible implementation, the data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or,

[0044] The data to be processed is text data, the neural network model is used to implement the natural language generation task, and the processing result is text data.

[0045] In one possible implementation, the neural network model includes a feature extraction network and a task network, and the feature extraction network includes a linear transformation layer.

[0046] In one possible implementation, the neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head; or,

[0047] The neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

[0048] In a fifth 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 the first aspect and any optional method thereof.

[0049] In the sixth 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 execute the second aspect and any optional method thereof.

[0050] In the seventh 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, it enables the computer to execute the above-mentioned first aspect and any optional method thereof, as well as the above-mentioned second aspect and any optional method thereof.

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

[0052] In a ninth aspect, the present application provides a chip system comprising a processor configured to support the execution of a data processing device to implement the functions described in the aforementioned aspects, such as transmitting or processing the data or information described in the aforementioned methods. In one possible design, the chip system further comprises a memory configured to store program instructions and data necessary for executing the device or training the device. The chip system may consist of a single chip or may include a chip and other discrete components. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] FIG1A is a schematic diagram of a structure of an artificial intelligence main framework;

[0054] 1B and 1C are schematic diagrams of the application system framework of the present invention;

[0055] FIG1D is a schematic diagram of an optional hardware structure of a terminal;

[0056] FIG2 is a schematic diagram of the structure of a server;

[0057] FIG3 is a schematic diagram of a system architecture of the present application;

[0058] Figure 4 shows a process of cloud services;

[0059] FIG5 is a flowchart of a data processing method provided in an embodiment of the present application;

[0060] 6 to 9D are schematic diagrams of a data processing method provided in an embodiment of the present application;

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

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

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

[0064] FIG13 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0066] 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.

[0067] 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.

[0068] As used herein, the terms "substantially," "about," and similar terms are used as terms of approximation, not as terms of degree, and are intended to take into account the inherent variations in measurements or calculations that one of ordinary skill in the art would recognize. Furthermore, the use of "may" when describing embodiments of the present invention refers to "one or more possible embodiments." As used herein, the terms "use," "using," and "used" may be considered synonymous with the terms "utilize," "utilizing," and "utilized," respectively. Additionally, the term "exemplary" is intended to refer to an example or illustration.

[0069] First, let's describe the overall workflow of an AI system. See Figure 1A, which shows a schematic diagram of the main AI framework. This AI 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.

[0070] (1) Infrastructure

[0071] 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.

[0072] (2) Data

[0073] 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.

[0074] (3) Data processing

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

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

[0077] 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.

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

[0079] (4) General ability

[0080] 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.

[0081] (5) Smart products and industry applications

[0082] 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.

[0083] This application can be applied to the field of natural language processing in the field of artificial intelligence. Taking natural language processing as an example, the following will introduce multiple application scenarios that have been implemented in products.

[0084] First, we will introduce the application scenarios of this application. This application can be applied to, but is not limited to, applications with image generation or natural language synthesis functions (hereinafter referred to as generation applications) or cloud services provided by cloud-side servers. The following are introduced respectively:

[0085] 1. Generate application

[0086] The product form of the embodiment of the present application can be a generation type application. The generation type application can be run on a terminal device or a cloud-side server.

[0087] In one possible implementation, a generation application can implement image generation or natural language synthesis tasks to obtain processing results.

[0088] For example, a generation application may implement at least an image generation task based on a diffusion method and a natural language conversation task, but is not limited thereto.

[0089] In one possible implementation, the user can open a generation application installed on the terminal device and input image data or text data (the text may be triggered by an instruction and not necessarily actively input by the user). The generation application can use the model trained by the method provided in the embodiment of the present application, or process the image or text by the method provided in the embodiment of the present application, and present the processing results to the user (the presentation method may be but is not limited to display, playback, saving, uploading to the cloud side, etc.).

[0090] In one possible implementation, a user can open a generation application installed on a terminal device and input image data or text data. The generation application can send the image data or text data to a server on the cloud side. The server on the cloud side processes the image or text using a model trained using the method provided in an embodiment of the present application, and transmits the processing results back to the terminal device. The terminal device can present the processing results to the user (the presentation method can be, but is not limited to, display, playback, saving, uploading to the cloud side, etc.).

[0091] Next, the generation type application in the embodiment of this application is introduced from the functional architecture and the product architecture that realizes the function.

[0092] Referring to FIG. 1B , FIG. 1B is a schematic diagram of the functional architecture of a generation-type application in an embodiment of the present application:

[0093] In one possible implementation, as shown in FIG1B , a generation application 102 may receive input parameters 101 (e.g., including an image or text) and generate a processing result 103. The generation application 102 may be executed on (for example) at least one computer system and include computer code that, when executed by one or more computers, causes the computers to execute a multimodal model trained using the method provided in the embodiments of the present application.

[0094] Referring to FIG. 1C , FIG. 1C is a schematic diagram of the entity architecture for running a generation-type application in an embodiment of the present application:

[0095] Referring to FIG1C , FIG1C shows a schematic diagram of a system architecture. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers (FIG1C illustrates one server as an example), and the server 200 may provide image synthesis or natural language generation functions for one or more terminals.

[0096] Among them, the terminal 100 can be installed with a generation application, or a web page related to the image synthesis or natural language generation function can be opened. The above application and web page can provide an interface. The terminal 100 can receive the relevant parameters entered by the user on the image synthesis or natural language generation function interface, and send the above parameters to the server 200. The server 200 can obtain the processing results based on the received parameters and return the processing results to the terminal 100.

[0097] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters by itself without the cooperation of the server, and the embodiments of the present application are not limited to this.

[0098] Next, the product form of the terminal 100 in FIG1C is described;

[0099] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.

[0100] FIG1D shows a schematic diagram of an optional hardware structure of the terminal 100 .

[0101] 1D , the terminal 100 may include components such as a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), a processor 170, an external interface 180, and a power supply 190. Those skilled in the art will appreciate that FIG1D is merely an example of a terminal or multi-function device and does not limit the terminal or multi-function device. The terminal or multi-function device may include more or fewer components than shown, or may combine certain components or have different components.

[0102] The input unit 130 can be used to receive input digital or character information and generate key signal input related to user settings and function control of the portable multifunction device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can detect user touch operations on or near it (for example, operations performed on or near the touch screen using a finger, joint, stylus, or any other suitable object) and drive corresponding connected devices according to pre-set programs. The touch screen can detect user touch actions on the touch screen, convert the touch actions into touch signals and transmit them to the processor 170. It can also receive and execute commands sent by the processor 170; the touch signals include at least touch point coordinate information. The touch screen 131 provides an input interface and an output interface between the terminal 100 and the user. Touch screens can be implemented using various types, including resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch screen 131, the input unit 130 may also include other input devices. Specifically, the other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0103] Among them, other input devices 132 can receive input image data or text data.

[0104] The display unit 140 may be used to display information input by the user or provided to the user, various menus of the terminal 100, interactive interfaces, file display, and / or playback of any multimedia file. In an embodiment of the present application, the display unit 140 may be used to display the interface of a generated application, processing results, etc.

[0105] Memory 120 can be used to store instructions and data. It primarily includes an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files and text. The instruction storage area can store software units such as the operating system, applications, and instructions required for at least one function, or subsets or extensions thereof. It may also include non-volatile random access memory (RAM). It provides processor 170 with management functions for the hardware, software, and data resources within the computing and processing device, supporting control software and applications. It is also used to store multimedia files and running programs and applications.

[0106] The processor 170 is the control center of the terminal 100. It connects all components of the terminal 100 using various interfaces and circuits. By executing instructions stored in the memory 120 and accessing data stored therein, it executes various functions of the terminal 100 and processes data, thereby providing overall control of the terminal device. Optionally, the processor 170 may include one or more processing units. Preferably, the processor 170 may integrate an application processor and a modem processor, with the application processor primarily processing the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 170. In some embodiments, the processor and memory may be implemented on a single chip; in other embodiments, they may be implemented on separate chips. The processor 170 may also generate corresponding operational control signals and send them to the corresponding components of the computing and processing device. It may also read and process data in the software, particularly the data and programs in the memory 120, to enable the various functional modules therein to perform their corresponding functions, thereby controlling the corresponding components to operate as instructed.

[0107] Among them, the memory 120 can be used to store software codes related to the data processing method, the processor 170 can execute the steps of the chip's data processing method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to implement corresponding functions.

[0108] The RF unit 110 (optional) can be used to send and receive information or receive and send signals during a call. For example, after receiving downlink information from the base station, it is passed to the processor 170 for processing; in addition, it sends the designed uplink data to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF unit 110 can also communicate with network devices and other devices via wireless communication. This wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0109] In this embodiment of the present application, the RF unit 110 may send image data or text data to the server 200 and receive a processing result sent by the server 200.

[0110] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.

[0111] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.

[0112] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to other devices for communication, or to connect a charger to charge the terminal 100 .

[0113] Although not shown, the terminal 100 may also include a flash, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied to the terminal 100 shown in FIG1D .

[0114] Next, the product form of the server 200 in FIG1C is described;

[0115] FIG2 provides a schematic diagram of the structure of a server 200. As shown in FIG2, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.

[0116] Bus 201 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, FIG2 shows only one thick line, but this does not imply that there is only one bus or only one type of bus.

[0117] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0118] The memory 204 may include volatile memory, such as random access memory (RAM). The memory 204 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard drive (HDD), or solid state drive (SSD).

[0119] The memory 204 may be used to store software codes related to the data processing method, and the processor 202 may execute the steps of the data processing method of the chip, and may also schedule other units to implement corresponding functions.

[0120] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

[0121] It should be understood that the steps related to the model reasoning process in the embodiments of this application involve AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture described above. The system architecture provided in the embodiments of this application is described in detail below with reference to Figure 3.

[0122] FIG3 is a schematic diagram of the system architecture provided by an embodiment of the present application. As shown in FIG3 , the 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 .

[0123] 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.

[0124] The execution device 510 may be a terminal device or a server that runs the aforementioned generated application program.

[0125] The data acquisition device 560 is used to collect training samples. The training samples can be image data or text data. After collecting the training samples, the data acquisition device 560 stores these training samples in the database 530.

[0126] The training device 520 can train the neural network to be trained (such as the neural network model in the embodiment of the present application (such as including feature extraction network, task network, etc.)) based on the training samples maintained in the database 530 to obtain the target model / rule 501.

[0127] It should be understood that the training device 520 can perform a pre-training process on the neural network to be trained based on the training samples maintained in the database 530, or fine-tune the model based on the pre-training.

[0128] It should be noted that, in actual applications, the training samples 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 samples maintained in the database 530, but may also obtain training samples 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.

[0129] The target model / rule 501 obtained through training with the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in FIG3 . The execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR) device, an in-vehicle terminal, etc., or a server, etc.

[0130] Specifically, the training device 520 may transfer the trained model to the execution device 510 .

[0131] In Figure 3, the execution device 510 is configured with an input / output (I / O) interface 512 for data interaction with an external device. The user can input data (such as image data or text data in the embodiment of the present application) into the I / O interface 512 through the client device 540.

[0132] Preprocessing module 513 and preprocessing module 514 are used to preprocess the input data received by I / O interface 512. It should be understood that preprocessing module 513 and preprocessing module 514 may be absent or only one preprocessing module may be present. If preprocessing module 513 and preprocessing module 514 are absent, computing module 511 may be used directly to process the input data.

[0133] 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.

[0134] Finally, the I / O interface 512 provides the processed results to the client device 540 and thus to the user.

[0135] In the scenario shown in FIG3 , 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 method. 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.

[0136] It is worth noting that FIG3 is merely a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationships between the devices, components, modules, etc. shown in the figure do not constitute any limitation. For example, in FIG3 , 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. It should be understood that the execution device 510 can be deployed in the client device 540.

[0137] From the inference side of the model:

[0138] In the embodiment of the present application, the computing module 511 of the above-mentioned execution device 510 can obtain the code stored in the data storage system 550 to implement the steps related to the model reasoning process in the embodiment of the present application.

[0139] In an embodiment of the present application, the computing module 511 of the execution device 510 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 may be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

[0140] Specifically, the computing module 511 of the execution device 510 can be a hardware system with an execution instruction function, and the steps related to the model reasoning process provided in the embodiment of the present application can be software codes stored in the memory. The computing module 511 of the execution device 510 can obtain the software code from the memory and execute the obtained software code to implement the steps related to the model reasoning process provided in the embodiment of the present application.

[0141] It should be understood that the computing module 511 of the execution device 510 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to the model reasoning process provided in the embodiment of the present application can also be implemented by the hardware system that does not have the function of executing instructions in the computing module 511 of the execution device 510, which is not limited here.

[0142] From the training side of the model:

[0143] In an embodiment of the present application, the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 3, which can be integrated into the training device 520 or deployed separately from the training device 520) to implement the steps related to model training in the embodiment of the present application.

[0144] In an embodiment of the present application, the training device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 may be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

[0145] It should be understood that the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided in the embodiments of the present application can also be implemented by the hardware system in the training device 520 that does not have the function of executing instructions, which is not limited here.

[0146] 2. Server-provided cloud services for image synthesis or natural language generation:

[0147] In a possible implementation, the server may provide image synthesis or natural language generation services to the terminal side through an application programming interface (API).

[0148] Among them, the terminal device can send relevant parameters (such as images, text and other data) to the server through the API provided by the cloud. The server can obtain processing results based on the received parameters, etc., and return the processing results to the terminal.

[0149] The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.

[0150] FIG4 shows a process of using a cloud service of image synthesis or natural language generation function provided by a cloud platform.

[0151] 1. Activate and purchase content review services.

[0152] 2. Users can download the software development kit (SDK) corresponding to the content review service. Usually, the cloud platform provides multiple development versions of the SDK for users to choose according to the requirements of the development environment, such as JAVA version SDK, Python version SDK, PHP version SDK, Android version SDK, etc.

[0153] 3. After downloading the corresponding version of the SDK locally as needed, the user imports the SDK project into the local development environment, configures and debugs it, and can also develop other functions in the local development environment, forming an application that integrates image synthesis or natural language generation capabilities.

[0154] 4. When an image synthesis or natural language generation application is in use and needs to perform image synthesis or natural language generation, it can trigger an API call for the image synthesis or natural language generation function. When the application triggers the image synthesis or natural language generation function, it initiates an API request to the running instance of the image synthesis or natural language generation service in the cloud environment. The API request includes an image, and the running instance in the cloud environment processes the image to obtain the processing result.

[0155] 5. The cloud environment returns the processing results to the application, thereby completing an image synthesis or natural language generation function call.

[0156] 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.

[0157] (1) Neural Network

[0158] 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:

[0159] Where s = 1, 2, ... n, where 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 this 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.

[0160] (2) Transformer layer

[0161] The neural network includes an embedding layer and at least one transformer layer, and 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&norm 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.

[0162] (3) Attention mechanism

[0163] 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:

[0164] 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 Query element of the Target and all elements of 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 has changed.

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

[0166] 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, we can 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.

[0167] (5) Backpropagation algorithm

[0168] Convolutional neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during training, reducing the reconstruction error loss of the super-resolution model. Specifically, the forward propagation of the input signal to the output generates an error loss. This error loss information is then backpropagated to update the parameters of the initial super-resolution model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by the error loss, aiming to obtain the optimal super-resolution model parameters, such as the weight matrix.

[0169] (6) Loss function

[0170] During the training of a deep neural network, because we want the output of the deep neural network to be as close as possible to the desired predicted value, we can compare the current network's predicted value with the desired target value and then update the weight vector of each layer of the neural network based on the difference between the two. (Of course, there is usually an initialization process before the first update, which is to pre-configure the parameters for each layer in the deep neural network.) For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value. This adjustment is continued until the deep neural network can predict the desired target value or a value very close to the desired target value. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value." This is the loss function (or objective function), which is an important equation used to measure the difference between the predicted value and the target value. For example, the loss function output value (loss) indicates a greater difference, so training a deep neural network becomes a process of minimizing this loss as much as possible.

[0171] As neural network models continue to grow in size, they incur significant computational and storage costs during model training and inference. Existing techniques often employ fine-tuning of pre-trained large models to adapt to downstream tasks, thereby reducing model training costs.

[0172] However, in order to ensure model accuracy, the number of parameters that need to be adjusted during fine-tuning in the existing technology is still relatively large. Therefore, a low-cost model fine-tuning method is urgently needed.

[0173] In order to solve the above problems, the present invention provides a data processing method. The data processing method of the present invention is described in detail below with reference to the accompanying drawings.

[0174] Refer to Figure 5, which is a flow chart of a data processing method provided in an embodiment of the present application. As shown in Figure 5, a data processing method provided in an embodiment of the present application may include steps 501 to 503, and these steps are described in detail below.

[0175] 501. Obtain data to be processed.

[0176] In one possible implementation, the data to be processed is text data or image data, and the neural network model used to process the data to be processed can be used to implement an image generation task based on the text data or image data. For example, the image generation task can be an image enhancement task (e.g., denoising).

[0177] In a possible implementation, the image may be pre-stored locally in the terminal or server, or may be obtained by the terminal from the outside world (such as the Internet), or may be collected by the terminal in real time, for example, by a camera of the terminal.

[0178] In one possible implementation, the data to be processed is text data, and the neural network model used to process the data to be processed can be used to implement natural language generation tasks, for example, natural language generation tasks can be dialogue tasks, summary generation, text translation, cloze tasks, etc.

[0179] 502. Process the data to be processed according to a neural network model to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer, and when processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor.

[0180] In one possible implementation, the neural network model may include a linear transformation layer (linear layer).

[0181] For example, in one possible implementation, the neural network model includes a feature extraction network and a task network, and the feature extraction network includes the linear transformation layer.

[0182] In an embodiment of the present application, a fusion operation (such as a multiplication operation) with a weighting factor is added after at least one linear transformation layer in the neural network model. The weighting factor can be a parameter that is updated when the model is fine-tuned.

[0183] In one possible implementation, the neural network model is a pretrained model. When the neural network model is pretrained, the neural network model does not include weighting factors corresponding to the linear transformation layer. For example, when the neural network model is pretrained, the neural network model includes a linear transformation layer and a network layer directly connected to the linear transformation layer. The network layer directly connected to the linear transformation layer can process the output of the linear transformation layer.

[0184] In one possible implementation, when pre-training the neural network model, the weighting factor corresponding to the linear transformation layer is not updated. For example, when pre-training the neural network model, the neural network model includes a linear transformation layer, a weighting factor corresponding to the linear transformation layer, and a network layer connected after the weighting factor. The weighting factor can be a fixed parameter. The weighting factor and the output of the linear transformation layer can be fused, and the network layer connected after the weighting factor can process the fusion result.

[0185] In an embodiment of the present application, when fine-tuning the neural network model, in the feedforward process, that is, when the neural network model processes the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor. The network layer connected after the weighting factor can process the fusion result, and the weighting factor can be updated during back propagation.

[0186] Optionally, the weighting factor may be initialized to 1.

[0187] In one possible implementation, in addition to updating the weighting factor, the bias term, Layer Norm, and class embedding can also be updated.

[0188] Next, we will take the transformer-based neural network model as an example to introduce it.

[0189] In one possible implementation, the neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head.

[0190] In a possible implementation, the neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

[0191] Referring to Figure 6, Figure 6 is a schematic diagram of the structure of a transformer model. In the embodiment of the present application, the linear transformation layer that adds the weighting factor can be any linear transformation layer of any transformer layer in the neural network model.

[0192] It should be understood that the structure of Figure 6 is only an example, and the number of neural network layers can be set as needed. The embedding layer can embed the input to obtain multiple feature vectors. The core feature of the transformer model 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 each word vector in the sentence, thereby more comprehensively considering the impact of the context in the sentence on each word. The embedding layer can obtain N embedding vectors Xl based on the node features and position encoding of each node in the current sequence. The attention layer is connected to the embedding layer, obtains N embedding vectors from the embedding layer as input vectors, and synthesizes each input vector based on the correlation between each input vector in the N input vectors to obtain N output vectors, which are 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 the previous transformer layer.

[0193] In one possible implementation, the transformer layer in the transformer model can be constructed by operator sampling. Specifically, the attention head in the transformer layer in the transformer model can be constructed by operator sampling, wherein the transformer layer can include multiple attention heads, and optionally, the structure of each attention head in the multiple attention heads is the same.

[0194] Referring to Figure 7, Figure 7 is a schematic diagram of the structure of a transformer layer, wherein the transformer layer may include a multi-head attention layer (or simply referred to as an attention layer), an add and normalization (add&norm) layer, a feed forward net (FFN), and an add and normalization layer adjacent to each other.

[0195] Among them, the multi-head attention layer obtains N input vectors Xl from its upper layer, and the N input vectors Xl can be expressed as a matrix X. The multi-head attention layer adopts a self-attention mechanism to transform each vector based on the correlation between vectors to obtain N output vectors, which can 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, such as the transformer layer directly connected to the embedding layer in Figure 7, 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 a subsequent transformer layer, such as the multi-head attention layer included in a transformer layer directly connected to the upper transformer layer in Figure 7, the input vector it obtains is the output vector of the previous transformer layer. The multi-head attention layer can include multiple attention heads (such as Head 1, Head 2, ..., Head N shown in Figure 7).

[0196] Figure 8 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 Figure 8, the first transformation matrix Q, the second transformation matrix K and the third transformation matrix V are used to transform N input vectors respectively.<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 N 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:

[0197] 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:

[0198] Thus, we can get the vector sequence of N combination vectors corresponding to N input vectors<C1,C2,…,CN> , or matrix C. Based on this combination vector sequence, N output vectors can be obtained. Specifically, in one embodiment, the vector sequence of N combination vectors can be directly used as N 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:

[0199] 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 N 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 N output vectors.

[0200] Among them, the linear transformation layer in the embodiment of the present application can realize the above-mentioned processing of the input vector based on the transformation matrix (for example, the first transformation matrix, the second transformation matrix, the third transformation matrix and the fourth transformation matrix), or the linear transformation layer in the embodiment of the present application can be the linear transformation layer in FFN.

[0201] 503. Determine the loss based on the processing result, and update the weighting factor in the neural network model based on the loss to obtain the fine-tuned neural network model.

[0202] In one possible implementation, the data to be processed is image data with noise added, the neural network model includes a feature extraction network and a denoising network, and the feature extraction network includes the linear transformation layer; the processing result is the denoised image data output by the denoising network, and further, the loss can be determined based on the processing result and the image data before noise is added.

[0203] An embodiment of the present application provides a data processing method, the method comprising: obtaining data to be processed; processing the data to be processed according to a neural network model to obtain a processing result; wherein the neural network model comprises a linear transformation layer and a weighting factor corresponding to the linear transformation layer, and when processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor; determining the loss according to the processing result, and updating the weighting factor in the neural network model according to the loss to obtain the fine-tuned neural network model. In the above manner, when fine-tuning the neural network model, an updateable weighting factor is added after the linear transformation layer. While ensuring the accuracy of the fine-tuning model, the number of other updated model parameters can be reduced, thereby reducing the cost of model fine-tuning.

[0204] In addition, an embodiment of the present application also provides a data processing method. Different from the embodiment corresponding to Figure 5 above, this embodiment is a model inference process performed based on a model fine-tuned based on the embodiment corresponding to Figure 5. The method may include: obtaining data to be processed; processing the data to be processed according to a neural network model to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer. When processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor.

[0205] In one possible implementation, the data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or, the data to be processed is text data, the neural network model is used to implement a natural language generation task, and the processing result is text data.

[0206] In a possible implementation, the neural network model includes a feature extraction network and a task network, and the feature extraction network includes the linear transformation layer.

[0207] In one possible implementation, the neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head; or, the neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

[0208] In one possible implementation, the neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include the weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

[0209] The large model parameter fine-tuning method provided in this application can greatly reduce the cost of training and storing large models, allowing consumers to fine-tune public large models based on their own small amount of vertical domain data. The embodiments of this application can be effectively used in image generation applications based on diffusion methods, as well as chatbot systems, etc.

[0210] For example, in image generation based on diffusion methods, large pre-trained diffusion models now have powerful general image generation capabilities. However, directly applying large pre-trained diffusion models to certain specific fields, such as portrait generation, cannot achieve very perfect results. Therefore, it is necessary to fine-tune the pre-trained diffusion model on the downstream portrait dataset. The efficient parameter fine-tuning strategy proposed in the embodiments of the present application can significantly improve the training speed and storage cost without sacrificing the effect.

[0211] For example, in vertical chatbot systems, large language models can achieve very strong general question-answering capabilities through self-supervised pre-training with large-scale data. However, the question-answering effect in certain vertical fields, such as law and medicine, is poor. By collecting data in these fields and performing targeted fine-tuning, good results can be achieved. The efficient parameter fine-tuning strategy proposed in the embodiments of this application can significantly improve training speed and storage costs without sacrificing results.

[0212] Next, taking the diffusion model as an example, a specific process provided by this application is introduced (fine-tuning the diffusion model can be referred to as DiffFit). The flow chart can be shown in FIG9A . It mainly includes the following steps:

[0213] 1. Input the image and perform data enhancement on the image

[0214] 2. Add Gaussian noise to the image

[0215] 3. Feed the image and label into the backbone network for feature extraction

[0216] 4. The extracted features are sent to the denoising network for decoding and prediction to obtain the results

[0217] 5. When fine-tuning the model, you can perform:

[0218] a) Freeze all parameters and only fine-tune the learnable scaling factors and bias terms.

[0219] b) Calculate the loss function using the output of the denoising network and the original image.

[0220] Figure 9B shows the architecture comparison of the fully fine-tuned method and DiffFit. DiffFit is simple and effective, in which most weights are frozen and only the bias term, scale factor γ, Layer Norm, and class embedding are trained, which only account for 0.12% of the entire model.

[0221] As shown in Figure 9C, which shows a pseudocode diagram of the scaling factor, a learnable scale factor γ is inserted into several modules of the diffusion model. γ is initialized to 1.0 and multiplied at the corresponding layer of each block. Currently, mainstream diffusion models are based on the Transformer and consist of many attention layers. Each attention layer typically contains multiple components, such as a multi-head self-attention network, a feedforward network, and layer normalization. Here, γ only acts on the multi-head self-attention network.

[0222] The left figure in Figure 9D shows the pseudo code 2 for the scaling factor, and the right figure in Figure 9D shows the pseudo code for the training strategy. During fine-tuning, all parameters of the diffusion model are initially frozen, and then only specific parameter scaling factors related to bias, class embedding, normalization, and so on are selectively unfrozen. DiffFit achieves fast fine-tuning, as shown in (2) in the algorithm of Figure 9D, minimizing the interference with pre-trained weights. Based on DiT-XL / 2 (a publicly available pre-trained large model), DiffFit only needs to update 0.12% of its parameters, resulting in training time about 2 times faster than full fine-tuning. The method provided in the embodiment of the present application avoids catastrophic forgetting while strengthening the knowledge of the pre-trained model and enabling it to adapt to specific tasks.

[0223] During testing, after fine-tuning on several datasets (e.g., K), only the complete parameters of the original model and a copy of the K dataset-specific trainable parameters need to be stored, where the trainable parameters are typically less than 1M. These weights are combined and loaded into the diffusion model for inference, which can be migrated to multiple downstream data tasks to generate images based on category labels. This solution greatly reduces storage overhead.

[0224] Next, taking DiffFit as an example, the beneficial effects of the embodiments of the present application are described in combination with specific experiments:

[0225] In our experimental setup, we fine-tune on a small downstream dataset at 256x256 resolution using eight V100 GPUs, a total batch size of 256, and train for 24K iterations. We chose eight commonly used fine-grained datasets: Food101, SUN397, DF-20M mini, Caltech101, CUB-200-2011, ArtBench-10, Oxford Flowers, and Stanford Cars. We used 50 sampling steps to obtain the FID (Fréchet Inception Distance) for all tasks. Most of these datasets were selected from CLIP downstream tasks, with the exception of ArtBench-10, as it has a different distribution from ImageNet, enabling a more comprehensive evaluation of DiffFit's out-of-distribution generalization performance.

[0226] Using FID as the evaluation metric, the lower the FID, the better the performance.

[0227] Experiments show that DiffFit achieves the lowest FID on average across 8 downstream tasks. While fully fine-tuned is a strong baseline, achieving slightly better results on 3 of the 8 datasets, it requires fine-tuning 100% of the parameters.

[0228] DiffFit's training parameters and training time are greatly improved compared to full fine-tuning, and it also has significant advantages over other parameter-efficient methods, as shown in Table 1. Table 1 shows the effects of DiffFit on 8 downstream datasets.

[0229] Table 1

[0230] In addition, considering that generating images of different resolutions is a special distribution shift, the method proposed in the embodiment of this application can easily adapt a pre-trained low-resolution diffusion model to generate high-resolution images. To demonstrate the effectiveness of DiffFit, a pre-trained ImageNet 256*256 DiT-XL / 2 model was loaded and fine-tuned on ImageNet 512*512. DiT-XL / 2 was fine-tuned on ImageNet 512*512 using 32 V100 GPUs with a batch size of 1024 and 30K iterations. FID was reported using 250 sampling steps.

[0231] Experiments show that DiffFit achieves 3.02 FID on the ImageNet 512×512 benchmark, surpassing ADM's 3.84 and the official DiT's 3.04. DiffFit sets a new state-of-the-art method among diffusion-based methods. Importantly, the method provided in the embodiment of the present application is much more efficient than previous methods, as the fine-tuning process only requires 51 GPU days of overhead. Even taking into account 950 GPU days of pre-training, the method provided in the embodiment of the present application still outperforms the more than 1,500 GPU days required for DiT and ADM.

[0232] We used DiffFit to fine-tune the Food101 dataset at a resolution of 512 × 512. The results show that using DiffFit to fine-tune pre-trained Food101 256 × 256 checkpoints yields a 4-point improvement in FID compared to full fine-tuning. Table 2 shows the effectiveness of DiffFit on high-resolution image generation.

[0233] Table 2

[0234] It should be understood that the embodiments of the present application are not limited to the application scenarios of the generated model. Any scenario that requires fine-tuning of a large model can effectively deploy the present invention, such as autonomous driving, terminal vision and other scenarios.

[0235] 10 , which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in FIG10 , a data processing device provided in an embodiment of the present application, the device 1000 includes:

[0236] Acquisition module 1001, used to acquire data to be processed;

[0237] For a detailed description of the acquisition module 1001 , reference may be made to the description of step 501 in the above embodiment, which will not be repeated here.

[0238] The processing module 1002 is configured to process the data to be processed according to a neural network model to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer. When processing the data to be processed, the neural network model is configured to fuse the output of the linear transformation layer with the corresponding weighting factor;

[0239] According to the processing result, the loss is determined, and the weighting factor in the neural network model is updated according to the loss to obtain the fine-tuned neural network model.

[0240] For a detailed description of the processing module 1002 , reference may be made to the description of step 502 and step 503 in the above embodiment, which will not be repeated here.

[0241] In one possible implementation, the data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or,

[0242] The data to be processed is text data, the neural network model is used to implement a natural language generation task, and the processing result is text data.

[0243] In one possible implementation, the data to be processed is image data with added noise, the neural network model includes a feature extraction network and a denoising network, the feature extraction network includes the linear transformation layer; the processing result is the denoised image data output by the denoising network;

[0244] The processing module is specifically used to:

[0245] The loss is determined based on the processing result and the image data before adding noise.

[0246] In one possible implementation, the neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include the weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

[0247] In a possible implementation, the neural network model includes a feature extraction network and a task network, and the feature extraction network includes the linear transformation layer.

[0248] In one possible implementation, the neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head.

[0249] In a possible implementation, the neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

[0250] In addition, an embodiment of the present application further provides a data processing device, the device comprising:

[0251] An acquisition module is used to obtain data to be processed;

[0252] According to the neural network model, the data to be processed is processed to obtain a processing result; wherein, the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer. When processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor.

[0253] In one possible implementation, the data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or,

[0254] The data to be processed is text data, the neural network model is used to implement a natural language generation task, and the processing result is text data.

[0255] In a possible implementation, the neural network model includes a feature extraction network and a task network, and the feature extraction network includes the linear transformation layer.

[0256] In a possible implementation, the neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head; or,

[0257] The neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

[0258] Next, an execution device provided in an embodiment of the present application is introduced. Please refer to Figure 11. Figure 11 is a structural diagram of an execution device provided in an embodiment of the present application. The execution device 1100 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 1100 includes: a receiver 1101, a transmitter 1102, a processor 1103 and a memory 1104 (wherein the number of processors 1103 in the execution device 1100 can be one or more, and Figure 11 takes one processor as an example), wherein the processor 1103 may include an application processor 11031 and a communication processor 11032. In some embodiments of the present application, the receiver 1101, the transmitter 1102, the processor 1103 and the memory 1104 may be connected via a bus or other means.

[0259] The memory 1104 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1103. A portion of the memory 1104 may also include non-volatile random access memory (NVRAM). The memory 1104 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.

[0260] Processor 1103 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 of these buses are referred to as a bus system in the figure.

[0261] The methods disclosed in the above embodiments of the present application can be applied to or implemented by processor 1103. Processor 1103 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 1103. The above processor 1103 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 1103 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, or registers. This storage medium is located in memory 1104. Processor 1103 reads information from memory 1104 and, in conjunction with its hardware, completes the steps involved in the model inference process in the above method.

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

[0263] The present application also provides a training device. Please refer to FIG. 12 , which is a schematic diagram of the structure of a training device provided by an embodiment of the present application. Specifically, the training device 1200 is implemented by one or more servers. The training device 1200 may vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1212 (e.g., one or more processors), a memory 1232, and one or more storage media 1230 (e.g., one or more mass storage devices) storing application programs 1242 or data 1244. The memory 1232 and storage medium 1230 may be either ephemeral or persistent storage. The program stored in the storage medium 1230 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 1212 may be configured to communicate with the storage medium 1230 to execute the series of instruction operations in the storage medium 1230 on the training device 1200.

[0264] The training device 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input and output interfaces 1258; or, one or more operating systems 1241, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0265] In the embodiment of the present application, the central processing unit 1212 is used to execute actions related to model training in the above embodiment.

[0266] 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.

[0267] 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.

[0268] 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 data processing method described in the above embodiment, or so that the chip in the training device executes the data processing 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, 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.

[0269] Specifically, see Figure 13 , which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip may be a neural network processor (NPU) 1300. NPU 1300 is mounted on a host CPU (host CPU) as a coprocessor, with tasks assigned by the host CPU. The core of the NPU is arithmetic circuit 1303, which is controlled by controller 1304 to extract matrix data from memory and perform multiplication operations.

[0270] In some implementations, the arithmetic circuit 1303 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 1303 is a two-dimensional systolic array. The arithmetic circuit 1303 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, the arithmetic circuit 1303 is a general-purpose matrix processor.

[0271] For example, assume there are input matrix A, weight matrix B, and output matrix C. The computation circuit retrieves the corresponding data of matrix B from weight memory 1302 and caches it on each PE in the computation circuit. The computation circuit then retrieves the data of matrix A from input memory 1301 and performs a matrix operation on it with matrix B. The partial or final matrix result is stored in accumulator 1308.

[0272] Unified memory 1306 is used to store input and output data. Weight data is directly transferred to weight memory 1302 through the Direct Memory Access Controller (DMAC) 1305. Input data is also transferred to unified memory 1306 through the DMAC.

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

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

[0275] DMAC is mainly used to move input data in the external memory DDR to the unified memory 1306 or to move weight data to the weight memory 1302 or to move input data to the input memory 1301.

[0276] The vector calculation unit 1307 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit 1303, 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.

[0277] In some implementations, the vector calculation unit 1307 can store the processed output vector in the unified memory 1306. For example, the vector calculation unit 1307 can apply a linear function or a nonlinear function to the output of the operation circuit 1303, 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 1307 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 1303, for example, for use in subsequent layers in a neural network.

[0278] An instruction fetch buffer 1309 connected to the controller 1304 is used to store instructions used by the controller 1304;

[0279] Unified memory 1306, input memory 1301, weight memory 1302, and instruction fetch memory 1309 are all on-chip memories. External memories are private to the NPU hardware architecture.

[0280] 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.

[0281] 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.

[0282] 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.

[0283] 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.

[0284] 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 (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website, computer, training device or 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 that includes one or more available media integrations. The available medium can be a magnetic medium, (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state drive (SSD)).

Claims

1. A data processing method, characterized in that: The method comprises: Get the data to be processed; According to the neural network model, the data to be processed is processed to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer, and when processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor; According to the processing result, the loss is determined, and the weighting factor in the neural network model is updated according to the loss to obtain the fine-tuned neural network model.

2. The method according to claim 1, characterized in that: The data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or The data to be processed is text data, the neural network model is used to implement a natural language generation task, and the processing result is text data.

3. The method according to claim 2, characterized in that The data to be processed is image data with added noise, the neural network model includes a feature extraction network and a denoising network, and the feature extraction network includes the linear transformation layer; The processing result is the denoised image data output by the denoising network; Determining the loss according to the processing result includes: The loss is determined based on the processing result and the image data before adding noise.

4. The method according to any one of claims 1 to 3, characterized in that: The neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include the weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

5. The method according to any one of claims 1 to 4, characterized in that: The neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head.

6. The method according to any one of claims 1 to 5, characterized in that: The neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

7. A data processing method, characterized in that: The method comprises: Get the data to be processed; According to the neural network model, the data to be processed is processed to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer, and when processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor.

8. The method according to claim 7, characterized in that The data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or The data to be processed is text data, the neural network model is used to implement a natural language generation task, and the processing result is text data.

9. The method according to claim 7 or 8, characterized in that: The neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include the weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

10. The method according to any one of claims 7 to 9, characterized in that: The neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head; or, The neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

11. A data processing device, characterized in that: The device comprises: An acquisition module is used to acquire data to be processed; A processing module, used for processing the data to be processed according to a neural network model to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer, and when processing the data to be processed, the neural network model is used for fusing the output of the linear transformation layer and the corresponding weighting factor; According to the processing result, the loss is determined, and the weighting factor in the neural network model is updated according to the loss to obtain the fine-tuned neural network model.

12. The device according to claim 11, characterized in that The data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or The data to be processed is text data, the neural network model is used to implement a natural language generation task, and the processing result is text data.

13. The device according to claim 12, characterized in that The data to be processed is image data with added noise, the neural network model includes a feature extraction network and a denoising network, the feature extraction network includes the linear transformation layer; the processing result is the denoised image data output by the denoising network; The processing module is specifically used for: The loss is determined based on the processing result and the image data before adding noise.

14. The device according to any one of claims 11 to 13, characterized in that: The neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include the weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

15. The device according to any one of claims 11 to 14, characterized in that: The neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head.

16. The device according to any one of claims 11 to 15, characterized in that The neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

17. A data processing device, characterized in that: The device comprises: An acquisition module is used to acquire data to be processed; According to the neural network model, the data to be processed is processed to obtain a processing result; wherein the neural network model includes a linear transformation layer and a weighting factor corresponding to the linear transformation layer, and when processing the data to be processed, the neural network model is used to fuse the output of the linear transformation layer and the corresponding weighting factor.

18. The device according to claim 17, characterized in that The data to be processed is text data or image data, the neural network model is used to implement an image generation task based on the text data or image data, and the processing result is image data; or The data to be processed is text data, the neural network model is used to implement a natural language generation task, and the processing result is text data.

19. The device according to claim 17 or 18, characterized in that The neural network model is a pre-trained model. When the neural network model is pre-trained, the neural network model does not include the weighting factors corresponding to the linear transformation layer; or, when the neural network model is pre-trained, the weighting factors corresponding to the linear transformation layer are not updated.

20. The device according to any one of claims 17 to 19, characterized in that The neural network model includes a transformer layer, the transformer layer includes an attention head, and the linear transformation layer is at least one linear transformation layer in the attention head; or, The neural network model includes a transformer layer, the transformer layer includes a feedforward FFN layer, and the linear transformation layer is at least one linear transformation layer in the FFN.

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

22. A computer program product, characterized in that The method comprises computer-readable instructions, and when the computer-readable instructions are executed on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 10.

23. A system comprising at least one processor and at least one memory; the processor and the memory are connected via a communication bus and communicate with each other; The at least one memory is used to store code; The at least one processor is configured to execute the code to perform the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Neural network searching method and related equipment

    CN113656563A

  • Joint modeling method and device for enhancing local features of pedestrians

    CN115240121A

  • Data processing method and device

    CN117273074A

  • Image classification method and related device

    WO2023020185A1

Cited By

  • Multi-modal large model image segmentation method and device based on hierarchical lexical representation

    CN120298683A

  • Encrypted network traffic classification method based on extensible federal forgetting learning

    CN120492987A

  • Encrypted network traffic classification method based on scalable federated forgetting learning

    CN120492987B

  • Image detection method and device, electronic equipment and storage medium

    CN120747586A