Method, system and apparatus for fine-tuning a pre-trained ai model in an end application

By embedding an adapter on the terminal side to fine-tune the pre-trained AI model, the problems of data leakage and network resource consumption in terminal applications are solved, achieving efficient privacy protection and resource saving.

CN119670837BActive Publication Date: 2025-11-07BEIJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311211028.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-19
Publication Date
2025-11-07
Estimated Expiration
2043-09-19

AI Technical Summary

Technical Problem

In existing technologies, when pre-trained AI models are fine-tuned in terminal applications, specific terminal data still needs to be obtained, leading to privacy leakage risks and network resource consumption, which cannot be effectively avoided.

Method used

Fine-tuning of pre-trained AI models is performed on the terminal side, and data processing is carried out through an embedded adapter to avoid data leakage and save network resources. The adapter is generated and the embedding process is controlled by the fine-tuning platform.

Benefits of technology

It enables fine-tuning of AI models on the terminal side, avoiding data leakage and saving network resources, thereby improving the privacy protection and resource utilization efficiency of terminal applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119670837B_ABST
    Figure CN119670837B_ABST
Patent Text Reader

Abstract

A method, system and device for fine-tuning a pre-trained AI model in a terminal application, wherein a terminal acquires a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model, the adapter being a sub-network structure involved in the pre-trained AI model when applied to a preset terminal application; the terminal embeds the adapter into the pre-trained AI model; and the terminal inputs data of the terminal application into the pre-trained AI model with the adapter for fine-tuning. The application also presets a fine-tuning platform, which generates corresponding adapters for different terminal applications of the pre-trained AI model, and controls the combination of the pre-trained AI model and the adapter and the subsequent fine-tuning of the pre-trained AI model with the embedded adapter in the terminal application. The application realizes fine-tuning of the pre-trained AI model on the terminal side, avoids leakage of data of the terminal application, and saves network resources.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial neural networks, and particularly relates to a method, system and device for fine-tuning a pre-trained artificial intelligence (AI) model in terminal application. BACKGROUND

[0002] With the large-scale popularity of terminals, various AI function requirements become increasingly diversified in terminal applications. For example, AI function requirements such as face recognition, speech recognition, image recognition and natural language processing can be implemented in different terminal applications. In this case, the requirements for AI models that implement these AI function requirements also become increasingly diversified. Currently, the training of AI models is completed by cloud servers in computer networks. At least one terminal sends data of a terminal application required for training an AI model to a cloud server, the cloud server inputs all the data of terminal applications received into an AI model for training in a centralized training manner, and after obtaining an AI model with guaranteed performance, the AI model is sent to the terminal for loading and use. This way of training AI models has the following disadvantages: first, the cloud server collects data of different terminal applications, which may cause a risk of privacy leakage of terminal application data; second, the AI model needs to be trained repeatedly for a long time to meet the use requirements of different terminal applications, which requires a large amount of computing power and network resources of the cloud server.

[0003] In order to overcome the above problems, a pre-trained large model (PLM) method can be used to implement an AI model. The PLM method refers to pre-training an AI model using large amounts of data of terminal applications, and then fine-tuning the pre-trained AI model for specific terminal applications. This way can improve the performance of the AI model for specific terminal applications, because the AI model has learned a large amount of general knowledge during pre-training, and then fine-tuned adaptively for specific terminal applications to obtain targeted knowledge. Currently, the PLM method is widely used in the implementation of natural language processing models, such as translation processing models, question and answer processing models or text generation processing models, etc.

[0004] However, when fine-tuning the pre-trained AI model in the process of implementing the AI model using the PLM method, data of specific terminal applications still need to be obtained, which cannot avoid privacy leakage, and the transmission of terminal application data still consumes network resources. SUMMARY

[0005] Therefore, the embodiment of the present application provides a method for fine-tuning a pre-trained AI model in terminal application, which fine-tunes the pre-trained AI model on the terminal side, avoids data leakage of the terminal application, and saves network resources.

[0006] The embodiment of the present application also provides a system for fine-tuning a pre-trained AI model in terminal application, which fine-tunes the pre-trained AI model on the terminal side, avoids data leakage of the terminal application, and saves network resources.

[0007] The embodiment of the present application provides a method for fine-tuning a pre-trained AI model in terminal application, which includes:

[0008] The terminal obtains a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model, wherein the adapter is a sub-network structure involved in the pre-trained AI model when the pre-trained AI model is applied to a preset terminal application;

[0009] The terminal embeds the adapter into the pre-trained AI model;

[0010] The terminal inputs data of the terminal application into the AI model with the adapter for fine-tuning.

[0011] In the above embodiment, after the terminal obtains the pre-trained AI model, the method further includes:

[0012] The terminal deploys the pre-trained AI model, inputs data of the terminal application into the pre-trained AI model, and performs inference.

[0013] In the above embodiment, the terminal obtains the pre-trained AI model and the adapter from a preset fine-tuning platform;

[0014] The terminal embeds the adapter into the pre-trained AI model under the control of the fine-tuning platform;

[0015] The terminal inputs data of the terminal application into the AI model with the adapter for fine-tuning under the control of the fine-tuning platform.

[0016] In the above embodiment, the terminal obtains a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model, which includes:

[0017] Under the control of the fine-tuning platform, the terminal divides a calculation area from the memory, divides the pre-trained AI model into a plurality of calculation blocks according to calculation logic, and stores a currently calculated calculation block in the calculation area;

[0018] Under control of the fine-tuning platform, the terminal divides an association management area from the memory, and stores an association relationship between a calculation block in the pre-trained AI model and the adapter;

[0019] The terminal stores other calculation blocks other than the current calculation block in the pre-trained AI model and the adapter in a storage area of the terminal.

[0020] In the above embodiment, the terminal embeds the adapter into the pre-trained AI model, including:

[0021] The current calculation block is obtained from the calculation area;

[0022] According to the association relationship of the association management area, the adapter corresponding to the current calculation block is determined, and the corresponding adapter is obtained;

[0023] The corresponding adapter is embedded into the full connection layer after the current calculation block.

[0024] In the above embodiment, the terminal inputs data applied by the terminal into the pre-trained AI model with the adapter, and performs fine-tuning, including:

[0025] In the current round of fine-tuning, the data applied by the terminal is input into the current calculation block, the forward propagation stage of fine-tuning is performed, and the fine-tuning result is obtained;

[0026] According to the fine-tuning result, the backward propagation stage of fine-tuning is performed, the network parameters in the adapter are updated, and the next round of fine-tuning is performed until the multiple rounds of fine-tuning are completed.

[0027] Another embodiment of the present application provides a system for fine-tuning a pre-trained AI model in a terminal application, including a fine-tuning platform and a terminal, wherein,

[0028] The fine-tuning platform is configured to provide the pre-trained AI model to be obtained by the terminal and at least one adapter corresponding to the pre-trained AI model to the terminal, the adapter is a sub-network structure involved in the pre-trained AI model when the pre-trained AI model is applied to a preset terminal application; control the terminal to complete fine-tuning of the pre-trained AI model;

[0029] The terminal is configured to obtain the pre-trained AI model and at least one adapter corresponding to the pre-trained AI model from the fine-tuning platform; under control of the fine-tuning platform, embed the adapter into the pre-trained AI model. Input data applied by the terminal into the AI model with the adapter, and perform fine-tuning.

[0030] In still another embodiment of the present application, an apparatus for fine-tuning a pre-trained AI model in a terminal application is provided, comprising a pre-trained AI model storage module, a pre-trained AI model memory partition management module, at least one adapter storage module, and an interface calling module, wherein,

[0031] The pre-trained AI model storage module is configured to store a pre-trained AI model and send the pre-trained AI model to a terminal.

[0032] The pre-trained AI model memory partition management module is configured to divide the memory of a terminal into regions, save a currently calculated calculation block in the pre-trained AI model in a divided calculation region, and save the association between the calculation block in the pre-trained AI model and an adapter in a divided association management region.

[0033] The adapter storage module is configured to set and save an adapter corresponding to different terminal applications, the adapter being a sub-network structure involved in the AI model when the AI model is applicable to a preset terminal application, and the adapter storage module is configured to send the saved adapter to the interface calling module upon receiving a call from the interface calling module.

[0034] The interface calling module is configured to receive a fine-tuning request, obtain the adapter from the corresponding adapter storage module, and send the adapter to a terminal.

[0035] In still another embodiment of the present application, a non-transitory computer readable storage medium is provided, the non-transitory computer readable storage medium storing instructions that, when executed by a processor, cause the processor to perform each step of any one of the methods for fine-tuning a pre-trained AI model in a terminal application.

[0036] In still another embodiment of the present application, a terminal device is provided, comprising a processor configured to perform each step of any one of the methods for fine-tuning a pre-trained AI model in a terminal application.

[0037] As seen above, the terminal of the embodiment of the present application acquires a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model, the adapter being a sub-network structure involved by the pre-trained AI model when applicable to a preset terminal application; the terminal embeds the adapter into the pre-trained AI model; the terminal inputs data of the terminal application into the pre-trained AI model with the adapter, and performs fine-tuning. Furthermore, the embodiment of the present application also presets a fine-tuning platform, which generates corresponding adapters for different terminal applications of the pre-trained AI model, and controls the combination of the pre-trained AI model and the adapter and the subsequent fine-tuning of the pre-trained AI model with the embedded adapter in the terminal application. In this way, the embodiment of the present application realizes fine-tuning of the pre-trained AI model on the terminal side, avoids leakage of data of the terminal application, and saves network resources. BRIEF DESCRIPTION OF DRAWINGS

[0038] Figure 1 A method flowchart for fine-tuning of a pre-trained AI model in a terminal application is provided for the embodiment of the present application.

[0039] Figure 2 A structure schematic diagram of a fine-tuning platform is provided for the embodiment of the present application.

[0040] Figure 3 A method specific example flowchart for fine-tuning of a pre-trained AI model in a terminal application under the control of a fine-tuning platform is provided for the embodiment of the present application.

[0041] Figure 4 A structure schematic diagram of a computing block in a pre-trained AI model and an adapter associated therewith is provided for the embodiment of the present application.

[0042] Figure 5 A system structure schematic diagram for fine-tuning of a pre-trained AI model in a terminal application is provided for the embodiment of the present application.

[0043] Figure 6 A schematic diagram of an electronic device is provided for another embodiment of the present application. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application will be described in detail below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0045] The terms "first", "second", "third", "fourth" and the like in the description and in the claims of the present application, and above-described drawings, if any, are used to distinguish between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so-termed, where appropriate, can be interchanged with each other to the extent that embodiments of the present application described herein can be carried out in other than the order shown or described herein. Furthermore, the terms "comprising" and "having", and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a list of steps or units is not necessarily limited to those steps or units that are clearly listed, but can include other steps or units that are not clearly listed or inherent to such processes, methods, products, or apparatuses.

[0046] The technical solutions of the present application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in some embodiments.

[0047] In order to solve the problem in the background art that when the AI model is implemented in the PLM mode, the data of the specific terminal application still needs to be obtained when the pre-trained AI model is fine-tuned, and privacy leakage cannot be avoided, and network resources are still consumed when the data of the terminal application is transmitted, the present application adopts a fine-tuning method of the pre-trained AI model on the terminal side. Specifically, the terminal of the present application obtains a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model, the adapter being a sub-network structure involved in the pre-trained AI model when it is applicable to a pre-set terminal application; the terminal embeds the adapter into the pre-trained AI model; the terminal inputs the data of the terminal application into the pre-trained AI model with the adapter and fine-tunes it.

[0048] Furthermore, the present application also pre-sets a fine-tuning platform, which generates corresponding adapters and controls the combination of the pre-trained AI model and the adapter and the subsequent fine-tuning of the pre-trained AI model with the adapter in the terminal application for different terminal applications of the pre-trained AI model.

[0049] In this way, the present application fine-tunes the pre-trained AI model on the terminal side, avoids the leakage of the data of the terminal application, and saves network resources.

[0050] In this way, the present application fine-tunes the pre-trained AI model on the terminal side, avoids the leakage of the data of the terminal application, and saves network resources.

[0051] Figure 1 A flowchart of a method for fine-tuning a pre-trained AI model in a terminal application is provided for the embodiments of the present application, and the specific steps thereof include:

[0052] Step 101, the terminal acquires a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model, the adapter being a sub-network structure involved in the pre-trained AI model when the pre-trained AI model is applicable to a preset terminal application;

[0053] Step 102, the terminal embeds the adapter into the pre-trained AI model;

[0054] Step 103, the terminal inputs data of the terminal application into the AI model with the adapter for fine-tuning.

[0055] In the above method, the pre-trained AI model is an AI model that has been pre-trained in a cloud server and provided to a terminal. The AI model is a neural network model that implements AI function requirements in terminal applications, such as face recognition, speech recognition, image recognition, and natural language processing. For example, a neural network model with a Transformer network structure can be used as the AI model, which can be referred to as a large model, but not a super large model with a GPT3 network structure. The fine-tuned AI model can be deployed in the corresponding terminal application in the terminal for use, realizing certain AI functions of the terminal application.

[0056] In the above method, after the terminal acquires the pre-trained AI model, the method further includes:

[0057] The terminal deploys the pre-trained AI model and inputs data of the terminal application into the pre-trained AI model for inference.

[0058] Here, the data volume of the network parameters in the inference of the pre-trained AI model is less than 10 bytes (B), and the terminal internal storage occupied in the inference process is within 5G. After inference, the pre-trained AI model is fine-tuned for the terminal application.

[0059] In the above method, the adapter is a custom sub-network structure, which mainly functions to embed a custom sub-network structure in the AI model. In the subsequent fine-tuning process of the AI model, each fine-tuning round only updates the network parameters in the adapter until the fine-tuning process is completed.

[0060] In the above method, the terminal acquires a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model includes:

[0061] The terminal divides a computing area in memory, divides the pre-trained AI model into multiple computing blocks according to a computing logic, and stores a currently computed computing block in the computing area;

[0062] The terminal divides an association management area in the memory, and stores an association relationship between a calculation block in the pre-trained AI model and the adapter;

[0063] The terminal stores other calculation blocks other than the current calculation block in the pre-trained AI model and the adapter in a storage area of the terminal.

[0064] In the method of embedding the adapter into the pre-trained AI model by the terminal, the method comprises:

[0065] obtaining the current calculation block from the calculation area;

[0066] determining the adapter corresponding to the current calculation block according to the association relationship in the association management area, and obtaining the corresponding adapter;

[0067] embedding the corresponding adapter after the full connection layer in the current calculation block.

[0068] On this basis, the terminal inputs data applied by the terminal into the pre-trained AI model with the adapter, and performs fine-tuning, which comprises:

[0069] in the current round of fine-tuning, inputting the data applied by the terminal into the current calculation block, performing a forward propagation stage of fine-tuning, and obtaining a fine-tuning result;

[0070] performing a backward propagation stage of fine-tuning according to the fine-tuning result, updating network parameters in the adapter, and performing the next round of fine-tuning until the multiple rounds of fine-tuning are completed.

[0071] The above method is completed under the control of a fine-tuning platform preset in the embodiment of the application. The fine-tuning platform faces different applications of the terminal, and can control the fine-tuning of the corresponding pre-trained AI model in the terminal across the terminal applications. The fine-tuning platform is also provided with a fine-tuning request interface for receiving a fine-tuning request, and setting the adapter of the pre-trained AI model of the corresponding terminal application and providing the adapter of the pre-trained AI model to the terminal according to the fine-tuning request. The fine-tuning platform can also control the division of the memory area in the terminal, and manage the current calculation block of the pre-trained AI model stored in the memory. The adapter corresponding to the current calculation block is called and embedded during fine-tuning, so as to ensure that the terminal performs efficient fine-tuning of the pre-trained AI model under the condition of limited terminal resources.

[0072] The fine-tuning platform can be arranged in the terminal, or arranged on other devices such as a cloud server or other terminals in a computer network, and communicate with the terminal. Herein, no limitation is made.

[0073] Figure 2 A schematic diagram of the fine-tuning platform provided in this application embodiment is shown in the figure. It includes a pre-trained AI model storage module, a pre-trained AI model memory regional management module, at least one adapter storage module, and an interface calling module.

[0074] The pre-trained AI model storage module is used to store pre-trained AI models and send the pre-trained AI models to the terminal.

[0075] The pre-trained AI memory regional management module is used to divide the terminal's memory into regions, store the current computation blocks in the pre-trained AI model in the divided computation regions, and store the association relationship between the computation blocks in the pre-trained AI model and the adapter in the divided association management regions.

[0076] The adapter storage module is used to set and save adapters for different terminal applications. The adapter is a sub-network structure involved when the AI ​​model is applied to a preset terminal application. It accepts calls from the interface call module and sends the saved adapters to the interface call module.

[0077] The interface call module is used to receive a fine-tuning request, retrieve the adapter from the corresponding adapter storage module, and send it to the terminal.

[0078] In this embodiment of the application, the fine-tuning platform mainly includes the following steps in the process of controlling the fine-tuning of the pre-trained AI model in the terminal application:

[0079] The first step is to receive a fine-tuning request for the pre-trained AI model from the corresponding terminal application.

[0080] The second step is to parse the fine-tuning request;

[0081] The third step is to control the terminal to load the pre-trained AI model requested by the fine-tuning request.

[0082] The fourth step is to control the terminal to load the data of the terminal application and the corresponding pre-trained AI model and the adapter suitable for the terminal application;

[0083] The fifth step involves the control terminal combining the pre-trained AI model with the adapter for fine-tuning training.

[0084] The following adopts Figure 3 The example shown illustrates the steps described above in detail.

[0085] Figure 3 The flowchart below illustrates a specific example of a method for fine-tuning a pre-trained AI model in a terminal application under the control of a fine-tuning platform, as provided in this application embodiment. The specific implementation is as follows.

[0086] The first step is to receive a fine-tuning request of a pre-trained AI model corresponding to a terminal application:

[0087] Step 301, for any pre-trained AI model, set a corresponding adapter for different terminal applications and store in the fine-tuning platform;

[0088] In this step, the adapter is set to be embedded into the corresponding pre-trained AI model to realize the fine-tuning of the general pre-trained AI model to the specific terminal application requirement;

[0089] Step 302, when the terminal application receives a call request of the pre-trained AI model, sends a fine-tuning request to the fine-tuning platform, which includes the terminal application information and the terminal application data information;

[0090] In this step, the fine-tuning request also includes the structure information of the adapter;

[0091] In this step, the data information of the terminal application includes the data type and data volume of the terminal application.

[0092] The second step is to analyze the fine-tuning request;

[0093] Step 303, analyze the fine-tuning request, determine that the fine-tuning request is a request to fine-tune the pre-trained AI model, and determine the requested pre-trained AI model and the adapter;

[0094] In this step, the request type is carried in the request header of the fine-tuning request, and the message header can be analyzed to know that the pre-trained AI model is to be fine-tuned;

[0095] In this step, the request body of the fine-tuning request carries the information of the terminal application, the structure information of the adapter, and the data information of the terminal application, etc., so as to determine the pre-trained AI model and the corresponding adapter;

[0096] Step 304, the fine-tuning platform obtains the pre-trained AI model from the AI model storage module of itself, obtains the adapter from the adapter storage module of itself, encapsulates the response of the fine-tuning request, and sends the response of the fine-tuning request to the terminal application.

[0097] The third step is to control the terminal to load the pre-trained AI model requested by the fine-tuning request:

[0098] Step 305, divide the pre-trained AI model into several calculation blocks with continuous calculation logic, and store the current calculation block in the calculation area obtained by dividing the terminal memory;

[0099] Step 306, in the memory area of the terminal, an association management area is applied for setting the association between each computing block in the pre-trained AI model and the adapter, and dynamically maintaining the transmission of the computing intermediate data between each computing block and the adapter.

[0100] The fourth step is implemented, and the terminal loads the data of the terminal application and the corresponding pre-trained AI model and the adapter suitable for the terminal application:

[0101] Step 307, after the terminal application receives the response to the fine-tuning request, the terminal applies two storage areas to store the data of the terminal application respectively, and initializes the adapter;

[0102] Step 308, the terminal embeds the stored adapter into the corresponding subnetwork structure in the pre-trained AI model according to the analysis of the fine-tuning platform on the fine-tuning request;

[0103] In this step, the adapter corresponding to each computing block of the pre-trained AI model is embedded into each computing block, and the pre-trained AI model and the adapter are managed.

[0104] Step 309, the association management area of the terminal updates the structure information of the pre-trained AI model with the adapter;

[0105] In this step, the association management area of the terminal stores the structure information of the pre-trained AI model with the adapter, so that the network parameters in the corresponding subnetwork structure in the pre-trained AI model can be dynamically and accurately loaded in the subsequent fine-tuning process.

[0106] The fifth step is implemented, and the terminal combines the pre-trained AI model and the adapter to perform fine-tuning training.

[0107] Step 310, for the currently computing computing block of the computing area, the corresponding adapter is embedded after the connection layer in the computing block;

[0108] Step 311, the data of the terminal application is input into the currently computing computing block to perform the forward propagation stage processing of fine-tuning, and the fine-tuning result is obtained;

[0109] In this step, the computing blocks of the pre-trained AI model are sequentially placed into the computing area of the terminal, and the associated adapter is embedded after the connection layer in the currently computing computing block of the pre-trained AI model according to the association relationship managed in the association management area of the terminal, and fine-tuned one by one until the pre-trained AI model is fine-tuned.

[0110] Step 312, in the back propagation phase of the fine-tuning process, according to the fine-tuning result, the pre-trained AI model structure is frozen, the network parameters in the adapter are updated, and the next round of fine-tuning is performed again.

[0111] In this step, in each round of fine-tuning process, only the adapter learns to achieve the characteristics of the corresponding terminal application, and the pre-trained AI model only extracts features and provides general features for the adapter.

[0112] Figure 4 The structure diagram of a computing block in the pre-trained AI model and its associated adapter provided by the embodiment of the application is shown in the figure. The pre-trained AI model adopts the Transformer structure, including the multi-head attention layer, the full connection layer and the regularization layer in the current computing block, and the corresponding adapter is embedded after the full connection layer in the current computing block. In the forward propagation phase of each round of fine-tuning, the data of the terminal application is input into the current computing block of the computing block, and the calculation is performed according to the calculation logic of the current computing block to obtain the fine-tuning result. In the back propagation phase of each round of fine-tuning, the network parameters in the corresponding adapter are updated according to the fine-tuning result, and the network parameters in other sub-network structures in the pre-trained AI model are not involved in the update.

[0113] Figure 5 The system structure diagram of a pre-trained AI model provided by the embodiment of the application in a terminal application is shown in the figure, which includes a fine-tuning platform and a terminal, wherein,

[0114] The fine-tuning platform is configured to provide the pre-trained AI model to be obtained by the terminal and at least one adapter corresponding to the pre-trained AI model to the terminal, the adapter is a sub-network structure involved in the pre-trained AI model when it is applicable to a preset terminal application; and control the terminal to complete the fine-tuning of the pre-trained AI model.

[0115] The terminal is configured to obtain the pre-trained AI model and at least one adapter corresponding to the pre-trained AI model from the fine-tuning platform; embed the adapter into the pre-trained AI model under the control of the fine-tuning platform; and input the data of the terminal application into the AI model with the adapter for fine-tuning.

[0116] In another embodiment of the application, a non-transitory computer readable storage medium is provided, which stores instructions, the instructions causing the processor to execute the method of fine-tuning the pre-trained AI model in the terminal application in one of the foregoing embodiments when executed by the processor.

[0117] Figure 6 A schematic diagram of an electronic device is provided for another embodiment of the present application. As shown, the present application provides an electronic device which can include a processor 601, wherein the processor 601 is configured to perform the steps of the above-mentioned method for fine-tuning a pre-trained AI model in terminal application. Figure 6 As can be further seen from the above, the electronic device provided by the above-mentioned embodiment further includes a non-transitory computer-readable storage medium 602 having stored thereon a computer program which, when executed by the processor 601, performs the steps of the above-mentioned method for fine-tuning a pre-trained AI model in terminal application. Figure 6 As can be further seen from the above, the electronic device provided by the above-mentioned embodiment further includes a non-transitory computer-readable storage medium 602 having stored thereon a computer program which, when executed by the processor 601, performs the steps of the above-mentioned method for fine-tuning a pre-trained AI model in terminal application.

[0118] In particular, the non-transitory computer-readable storage medium 602 can be a general storage medium such as a mobile disk, a hard disk, a FLASH, a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), or a portable compact disk read-only memory (CD-ROM), etc. The computer program stored on the non-transitory computer-readable storage medium 602, when executed by the processor 601, can cause the processor 601 to perform each step of the above-mentioned method for fine-tuning a pre-trained AI model in terminal application.

[0119] In practical applications, the non-transitory computer-readable storage medium 602 can be included in the device / apparatus / system described in the above-mentioned embodiments, or can exist separately and not be assembled into the device / apparatus / system. The above-mentioned computer-readable storage medium carries one or more programs which, when executed, can perform each step of the above-mentioned method for fine-tuning a pre-trained AI model in terminal application.

[0120] Still another embodiment of the present application provides a computer program product including a computer program or instructions which, when executed by a processor, implement each step of the above-mentioned method for fine-tuning a pre-trained AI model in terminal application.

[0121] The computer program product of the first aspect can include a computer readable storage medium. The computer readable storage medium can include instructions. The instructions can include one or both of: instructions for causing a computer to implement a method of the first aspect; and instructions for causing a computer to implement an apparatus of the second aspect. The computer readable storage medium can be tangible. The computer readable storage medium can include one or more of: nonvolatile memory, volatile memory, magnetic storage, optical storage, and so on. The computer readable storage medium can include one or more of: a semiconductor-based or other integrated circuit, a

[0122] Those skilled in the art will understand that the features recited in the various embodiments and / or claims of the present disclosure can be combined and / or interchanged, even if this is not explicitly stated in the present application. In particular, the features recited in the various embodiments and / or claims of the present application can be combined and / or interchanged, without departing from the spirit and teachings of the present application, and all such combinations and / or interchanges are to be considered within the scope of the present disclosure.

[0123] The principles and implementation ways of the present application are described in detail in the specific embodiments. The above descriptions of the embodiments are only used to help understand the method of the present application and its core idea, and are not used to limit the present application. For those skilled in the art, according to the ideas, spirits and principles of the present application, the specific implementation ways and application ranges can be changed, and any modification, equivalent replacement, improvement, etc. made by them shall be included in the scope of protection of the present application.

Claims

1. A method for fine-tuning a pre-trained AI model in a terminal application, characterized in that, The method comprises: The terminal obtains a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model from a preset fine-tuning platform, the adapter being a sub-network structure involved in the pre-trained AI model when the pre-trained AI model is applicable to a preset terminal application; The terminal embeds the adapter into the pre-trained AI model under the control of the fine-tuning platform; The terminal inputs data of the terminal application into the AI model with the adapter under the control of the fine-tuning platform for fine-tuning; Wherein, The terminal obtains a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model from a preset fine-tuning platform, which comprises: Under the control of the fine-tuning platform, the terminal divides a calculation area from the memory, divides the pre-trained AI model into a plurality of calculation blocks according to the calculation logic, and stores the currently calculated calculation block in the calculation area, Under the control of the fine-tuning platform, the terminal divides an association management area from the memory, and stores the association relationship between the calculation blocks in the pre-trained AI model and the adapter, The terminal stores other calculation blocks of the non-current calculation block in the pre-trained AI model and the adapter in the storage area of the terminal under the control of the fine-tuning platform; The terminal embeds the adapter into the pre-trained AI model under the control of the fine-tuning platform, which comprises: Obtain the currently calculated calculation block from the calculation area, According to the association relationship of the association management area, determine the adapter corresponding to the currently calculated calculation block, and obtain the corresponding adapter, Embed the corresponding adapter into the full connection layer after the currently calculated calculation block; The terminal inputs data of the terminal application into the pre-trained AI model with the adapter for fine-tuning, which comprises: In the current round of fine-tuning, input the data of the terminal application into the currently calculated calculation block, execute the forward propagation stage of fine-tuning, and obtain the fine-tuning result; According to the fine-tuning result, execute the backward propagation stage of fine-tuning, update the network parameters in the adapter, and perform the next round of fine-tuning until the multiple rounds of fine-tuning are completed.

2. The method of claim 1, wherein, After the terminal obtains the pre-trained AI model, it further comprises: The terminal deploys the pre-trained AI model, inputs data of the terminal application into the pre-trained AI model, and performs inference.

3. A system for fine-tuning a pre-trained AI model in an end application, characterized in that, Comprise: Fine-tuning platform and terminal, wherein, The fine-tuning platform is configured to provide a pre-trained AI model and at least one adapter corresponding to the pre-trained AI model to the terminal, the adapter being a sub-network structure involved in the pre-trained AI model when the pre-trained AI model is applicable to a preset terminal application; control the terminal to complete fine-tuning of the pre-trained AI model; The terminal is configured to: obtain the pre-trained AI model and at least one adapter corresponding to the pre-trained AI model from the fine-tuning platform; embed the adapter into the pre-trained AI model under the control of the fine-tuning platform; and input data applied by the terminal into the AI model with the adapter to perform fine-tuning. In this way, The obtaining of the pre-trained AI model and the at least one adapter corresponding to the pre-trained AI model comprises: Under the control of the fine-tuning platform, the terminal divides a calculation region from the memory, divides the pre-trained AI model into a plurality of calculation blocks according to a calculation logic, and stores a currently calculated calculation block in the calculation region, Under the control of the fine-tuning platform, the terminal divides an association management region from the memory, and stores an association relationship between the calculation blocks in the pre-trained AI model and the adapter, The terminal stores other calculation blocks of the pre-trained AI model other than the currently calculated calculation block and the adapter in a storage region of the terminal; The embedding of the adapter into the pre-trained AI model comprises: Obtaining the currently calculated calculation block from the calculation region, According to the association relationship of the association management region, determining the adapter corresponding to the currently calculated calculation block, and obtaining the corresponding adapter, Embedding the corresponding adapter after a fully connected layer in the currently calculated calculation block; The inputting of the data applied by the terminal into the pre-trained AI model with the adapter to perform fine-tuning comprises: In the current round of fine-tuning, inputting the data applied by the terminal into the currently calculated calculation block to perform a forward propagation stage of fine-tuning to obtain a fine-tuning result, According to the fine-tuning result, performing a backward propagation stage of fine-tuning to update network parameters in the adapter to perform the next round of fine-tuning until the multiple rounds of fine-tuning are completed.

4. An apparatus for fine-tuning a pre-trained AI model in a terminal application, the apparatus comprising: Comprise: A pre-trained AI model storage module, a pre-trained AI model memory region management module, at least one adapter storage module, and an interface calling module, wherein The pre-trained AI model storage module is configured to store a pre-trained AI model and send the pre-trained AI model to a terminal. The pre-trained AI model memory region management module is configured to divide a memory of the terminal into regions, save a currently calculated calculation block in the pre-trained AI model in a divided calculation region, and save an association relationship between the calculation blocks in the pre-trained AI model and an adapter in a divided association management region. The adapter storage module is configured to set and save adapters corresponding to different terminal applications, the adapters being sub-network structures involved in the AI model when the AI model is applicable to a preset terminal application, and the adapter storage module is configured to accept calling of the interface calling module and send the saved adapters to the interface calling module. An interface calling module is configured to receive a fine-tuning request, obtain the adapter from the corresponding adapter storage module, and send the adapter to the terminal to enable the terminal to perform each step of the method for fine-tuning a pre-trained AI model in a terminal application according to any one of claims 1 to 2.

5. A non-transitory computer readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores instructions that, when executed by a processor, cause the processor to perform each step of the method for fine-tuning a pre-trained AI model in a terminal application according to any one of claims 1 to 2.

6. A terminal device, characterized by comprising: A device includes a processor configured to perform each step of the method for fine-tuning a pre-trained AI model in a terminal application according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Recommendation method and system based on graph convolutional neural network, and storage medium

    CN114021018A

  • Generating differential privacy datasets using generative models

    CN114386470A