Data processing method and device, product and equipment
By screening and adjusting the network layers of the language model and combining business data from general and vertical fields, the problem of weakened general-domain prediction capabilities of the fine-tuned model was resolved, achieving more accurate model parameter adjustment.
Patent Information
- Application Number
- CN202510757232.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-09-12
AI Technical Summary
When existing technologies apply language models to vertical fields, fine-tuning usually weakens their ability to predict business data in general fields, resulting in inaccurate fine-tuning.
By obtaining business data from general and vertical fields, calculating the predicted gradient information, screening out the network layer with high discrimination, and adjusting the model parameters of this layer, an adjusted language model is formed.
The prediction capability of the language model in vertical fields is enhanced while maintaining the prediction capability in general fields, which improves the accuracy of model parameter adjustment.
Smart Images

Figure CN120633766A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a data processing method, apparatus, product, and device. Background Art
[0002] With the rapid development of computer networks, artificial intelligence is being applied to more and more business scenarios. As it is applied to different business scenarios, related models (such as language models) also need to be fine-tuned accordingly.
[0003] In existing applications, when a language model needs to be applied to a specific vertical field (referred to as the vertical domain), the business data of the vertical domain can be used to fine-tune the language model as a whole. However, this approach will bring a problem. After the language model is fine-tuned as a whole using the business data of the vertical domain, although the adjusted language model improves the predictive ability of the business data of the vertical domain, it is very likely to weaken the original predictive ability of the business data of the general field, resulting in inaccurate fine-tuning of the language model. Summary of the Invention
[0004] The present application provides a data processing method, apparatus, product, and device that can improve the accuracy of adjusting the model parameters of a language model using a vertical domain business dataset.
[0005] On one hand, the present application provides a data processing method, the method comprising:
[0006] Obtain target business data; the target business data includes M general business data selected from the general business data set and N vertical business data selected from the vertical business data set, where M and N are both positive integers;
[0007] Calling a language model to perform prediction processing on the target service data and obtain prediction gradient information; wherein the language model includes multiple network layers to be screened, and the prediction gradient information is used to indicate the discrimination degree of the prediction results of the multiple network layers for the target service data, and the prediction gradient information includes first prediction gradient information corresponding to M general service data and second prediction gradient information corresponding to N vertical domain service data;
[0008] Based on the first prediction gradient information and the second prediction gradient information, a target network layer is selected from multiple network layers of the language model; the target network layer has a higher degree of differentiation between prediction results for the N vertical domain service data and prediction results for the M general service data than other network layers in the multiple network layers;
[0009] The vertical domain business data set is used to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model. The adjusted language model is used to output corresponding response data based on the input business data.
[0010] In one aspect, the present application provides a data processing device, comprising:
[0011] The first acquisition module is used to acquire target business data; the target business data includes M general business data selected from the general business data set and N vertical domain business data selected from the vertical domain business data set, where M and N are both positive integers;
[0012] A second acquisition module is configured to call a language model to perform prediction processing on the target service data and obtain prediction gradient information; wherein the language model includes multiple network layers to be screened, and the prediction gradient information is used to indicate the discrimination degree of the prediction results of the multiple network layers for the target service data, and the prediction gradient information includes first prediction gradient information corresponding to M general service data and second prediction gradient information corresponding to N vertical domain service data;
[0013] a screening module, configured to screen a target network layer from the multiple network layers of the language model based on the first prediction gradient information and the second prediction gradient information; wherein the target network layer has a higher degree of differentiation between prediction results for the N vertical domain service data and prediction results for the M general service data than other network layers in the multiple network layers;
[0014] The adjustment module is used to adjust the model parameters of the target network layer in the language model using the vertical domain business data set to obtain an adjusted language model. The adjusted language model is used to output corresponding response data based on the input business data.
[0015] In one embodiment, the multiple network layers to be screened are multiple key network layers determined from all network layers included in the language model;
[0016] The filtering module filters out the target network layer from the multiple network layers of the language model based on the first predicted gradient information and the second predicted gradient information, including:
[0017] Based on the first predicted gradient information and the second predicted gradient information, a target network layer is screened out from a plurality of key network layers.
[0018] In one embodiment, the first predicted gradient information includes the first average gradient information of M general service data at each key network layer, and the second predicted gradient information includes the second average gradient information of N vertical domain service data at each key network layer. One key network layer corresponds to one first average gradient information and one second average gradient information;
[0019] The screening module screens out a target network layer from multiple key network layers based on the first predicted gradient information and the second predicted gradient information, including:
[0020] Calculate the gradient similarity between the first average gradient information and the second average gradient information corresponding to each key network layer respectively;
[0021] Sorting the multiple key network layers according to the order of the gradient similarities corresponding to the multiple key network layers from small to large to obtain the sorted multiple key network layers;
[0022] The top K key network layers among the sorted multiple key network layers are used as K pending network layers, where K is a positive integer;
[0023] Filter the target network layer from K pending network layers.
[0024] In one embodiment, the method in which the screening module screens out the target network layer from the K pending network layers includes:
[0025] Calculate the difference between the gradient amplitude of the second average gradient information and the gradient amplitude of the first average gradient information corresponding to each undetermined network layer respectively;
[0026] Sorting the K pending network layers according to the descending order of the amplitude differences corresponding to the K pending network layers to obtain the sorted K pending network layers;
[0027] The first L pending network layers among the sorted K pending network layers are determined as target network layers, where L is a positive integer and L is less than K.
[0028] In one embodiment, the difference between the first average gradient information and the second average gradient information corresponding to any key network layer is used to reflect the distinction between the prediction results of any key network layer for N vertical domain service data and the prediction results for M general service data;
[0029] The difference between the first average gradient information and the second average gradient information corresponding to any key network layer includes: the difference between the gradient direction of the first average gradient information corresponding to any key network layer and the gradient direction of the second average gradient information, and the difference between the gradient amplitude of the first average gradient information and the gradient amplitude of the second average gradient information corresponding to any key network layer;
[0030] The gradient similarity corresponding to any key network layer is used to reflect the difference between the gradient direction of the first average gradient information and the gradient direction of the second average gradient information corresponding to any key network layer.
[0031] In one embodiment, the general service data set includes a plurality of general service data; and the process of the first acquisition module selecting M general service data from the general service data set includes:
[0032] Performing feature conversion processing on each general business data in the general business data set to generate a feature vector for each general business data;
[0033] performing a first clustering process on the general service data in the general service data set based on the feature vector of each general service data to obtain a first clustering result;
[0034] Based on the first clustering result, M general service data are selected from the general service data set.
[0035] In one embodiment, the first clustering process is an M-type clustering process, and the first clustering result includes M first clusters obtained by clustering the general business data in the general business data set, each first cluster contains at least one general business data clustered in the general business data set, and each first cluster has its own cluster center, and the cluster center of any first cluster is the mean vector between the feature vectors of the general business data in any first cluster;
[0036] The first acquisition module selects M general service data from the general service data set based on the first clustering result, including:
[0037] Obtaining respectively the general business data whose feature vectors in the M first clusters are most similar to the corresponding cluster centers as the M general business data;
[0038] A first cluster is used to obtain one general service data among the M general service data.
[0039] In one embodiment, the vertical domain service data set includes multiple vertical domain service data; and the process of the first acquisition module selecting N vertical domain service data from the vertical domain service data set includes:
[0040] Perform feature conversion processing on each vertical domain service data in the vertical domain service data set to generate a feature vector for each vertical domain service data;
[0041] Performing a second clustering process on the vertical domain service data in the vertical domain service data set based on the feature vector of each vertical domain service data to obtain a second clustering result;
[0042] Based on the second clustering result, N vertical domain business data are selected from the vertical domain business data set.
[0043] In one embodiment, the second clustering process is an N-class clustering process, and the second clustering result includes N second clusters obtained by clustering the vertical domain business data in the vertical domain business data set, each second cluster contains at least one vertical domain business data clustered from the vertical domain business data set, and each second cluster has its own cluster center, and the cluster center of any second cluster is the mean vector between the feature vectors of the vertical domain business data in any second cluster;
[0044] The first acquisition module selects N vertical domain service data from the vertical domain service data set based on the second clustering result, including:
[0045] Obtaining the vertical service data whose feature vectors in the N second clusters are most similar to the corresponding cluster centers as the N vertical service data;
[0046] Among them, a second cluster is used to obtain one vertical domain business data among N vertical domain business data.
[0047] In one embodiment, the multiple network layers to be screened are multiple key network layers in a language model; and the process of the second acquisition module calling the language model to obtain the first prediction gradient information includes:
[0048] Input M general business data into the language model;
[0049] The language model is called to perform prediction processing on the M input general business data to obtain the general gradient information of the M general business data in multiple key network layers. One general business data has one general gradient information in one key network layer.
[0050] Average the general gradient information of the M general service data at each key network layer to obtain first average gradient information corresponding to each key network layer;
[0051] The first predicted gradient information includes multiple first average gradient information corresponding to multiple key network layers.
[0052] In one embodiment, any one of the M general service data is target general service data; the second acquisition module calls the language model to perform prediction processing on the input M general service data to obtain general gradient information of the M general service data at multiple key network layers, including:
[0053] Calling the language model to perform prediction processing on the target general service data to generate a first prediction loss value for the target general service data;
[0054] The first predicted loss value is derivatized at each key network layer to generate universal gradient information of the target universal service data at each key network layer.
[0055] In one embodiment, the multiple network layers to be screened are multiple key network layers in a language model; and the process of the second acquisition module calling the language model to obtain the second prediction gradient information includes:
[0056] Input N vertical domain business data into the language model;
[0057] The language model is called to perform prediction processing on the N input vertical domain service data to obtain the vertical domain gradient information of the N vertical domain service data at multiple key network layers. One vertical domain service data has one vertical domain gradient information at one key network layer.
[0058] Average the vertical gradient information of each key network layer for N vertical service data to obtain the second average gradient information corresponding to each key network layer;
[0059] The second predicted gradient information includes multiple second average gradient information corresponding to multiple key network layers.
[0060] In one embodiment, any one of the N vertical domain service data is target vertical domain service data; the second acquisition module calls the language model to perform prediction processing on the N vertical domain service data to obtain vertical domain gradient information of the N vertical domain service data at multiple key network layers, including:
[0061] Calling the language model to perform prediction processing on the target vertical domain business data to generate a second predicted loss value for the target vertical domain business data;
[0062] The second predicted loss value is derived at each key network layer to generate vertical gradient information of the target vertical service data at each key network layer.
[0063] In one embodiment, the adjustment module uses the vertical domain service data set to adjust the model parameters of the target network layer in the language model to obtain the adjusted language model, including:
[0064] Construct a training dataset using the vertical domain business dataset and M general business data;
[0065] The training data set is used to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model.
[0066] In one embodiment, the adjustment module uses the training data set to adjust the model parameters of the target network layer in the language model to obtain the adjusted language model, including:
[0067] A branch network layer is added to the target network layer of the language model, and the target network layer and the branch network layer are parallel to each other;
[0068] The language model is trained using the training data set to adjust the model parameters of the newly added branch network layer in the language model to obtain an adjusted language model; during the training process, all model parameters in the language model except the model parameters of the newly added branch network layer are frozen;
[0069] The model parameters obtained after adjusting the model parameters of the target network layer include: the original model parameters of the target network layer and the model parameters obtained after adjusting the model parameters of the branch network layer.
[0070] In one aspect, the present application provides a computer device including a memory and a processor, wherein the memory stores a computer program. When the computer program is executed by the processor, the processor executes the method in one aspect of the present application.
[0071] In one aspect, the present application provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the method in the above aspect.
[0072] In one aspect, the present application provides a computer program product, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in various optional embodiments of the above aspect.
[0073] The present application can obtain target business data; the target business data includes M general business data selected from the general business data set and N vertical business data selected from the vertical business data set; and, the language model can be called to perform prediction processing on the target business data to obtain prediction gradient information; wherein, the language model may include multiple network layers to be screened, and the prediction gradient information is used to indicate the discrimination of the multiple network layers for the prediction results of the target business data, and the prediction gradient information may include first prediction gradient information corresponding to the M general business data and second prediction gradient information corresponding to the N vertical business data; therefore, the present application can screen out the target network layer from the multiple network layers of the language model based on the first prediction gradient information and the second prediction gradient information; the discrimination between the prediction results of the N vertical business data and the prediction results of the M general business data of the screened target network layer is higher than that of other network layers in the above-mentioned multiple network layers; thus, the vertical business data set can be used to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model, and the adjusted language model can be used to output corresponding reply data according to the input business data. It can be seen that the method proposed in the present application can obtain the first prediction gradient information of the language model for M general business data and the second prediction gradient information for N vertical business data, and filter the network layer of the language model through the obtained first prediction gradient information and second prediction gradient information, thereby filtering out the target network layer with higher discrimination between the prediction results of the vertical business data and the prediction results of the general business data. When the model parameters of the language model are subsequently adjusted through the vertical business data set, the model parameters of the target network layer can be adjusted in a targeted manner, thereby ensuring that the adjusted language model can not only improve the ability to distinguish and predict the vertical business data, but also retain the original ability to distinguish and predict the general business data, thereby improving the accuracy of adjusting the model parameters of the language model. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] In order to more clearly illustrate the technical solutions in the present application or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0075] Figure 1 This is a schematic diagram of the structure of a network architecture of a data prediction network provided by an embodiment of the present application;
[0076] Figure 2 1 is a schematic diagram of a scenario of a language model after training and adjustment provided in an embodiment of the present application;
[0077] Figure 3 This is a flow chart of a data processing method provided in an embodiment of the present application;
[0078] Figure 4 This is a structural diagram of a target network layer after a branch network layer is added, provided in an embodiment of the present application;
[0079] Figure 5 1 is a schematic diagram of a framework of a language model after training and adjustment provided in an embodiment of the present application;
[0080] Figure 6 1 is a flow chart of a method for screening a target network layer provided in an embodiment of the present application;
[0081] Figure 7 This is a schematic diagram of the principle of screening to obtain a pending network layer provided by an embodiment of the present application;
[0082] Figure 8 This is a schematic diagram of the principle of screening to obtain the target network layer provided by an embodiment of the present application;
[0083] Figure 9 is a structural diagram of a data processing device provided in an embodiment of the present application;
[0084] Figure 10 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0085] The following will be combined with the accompanying drawings to clearly and completely describe the technical solutions in this application. Obviously, the embodiments described are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0086] All data collected in this application (such as general business data and vertical business data and other related data) are collected with the consent and authorization of the owner of the data (such as users, institutions or enterprises), and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of the relevant regions.
[0087] Here, the relevant technical concepts involved in this application are explained:
[0088] Large Language Model: LLM is a deep learning model based on massive text training. It captures the inherent laws of language through self-supervised learning and can understand, generate and reason about natural language text.
[0089] Multimodal Large Language Model: Multimodal Large Language Model (MLLM) is an artificial intelligence model extended from a large language model. It processes and integrates multiple modal information (such as images, text, videos, etc.) through a unified architecture to achieve joint understanding, reasoning, and generation of complex semantics.
[0090] Vertical fields: They can be referred to as vertical domains for short. They refer to segmented application scenarios with specific industry attributes, professional terminology systems, and business logic. The core of these vertical fields is to transform general large models (such as language models trained with general business data) into specialized models with domain expert-level capabilities through targeted training and optimization.
[0091] LoRA (Low-Rank Adaptation) is an efficient parameter fine-tuning method designed to adapt pre-trained models (such as large language models) to specific tasks without modifying all parameters of the original model. The essence of a low-rank matrix is its high information redundancy, allowing it to be approximated with fewer parameters. The rank of a matrix refers to the size of the largest linearly independent set of its rows or columns, reflecting the complexity of the independent information in the matrix.
[0092] k-means algorithm: is an unsupervised learning algorithm based on partitioning, which is used to divide the data set into k mutually exclusive clusters (k here only refers to the number, the specific value of k can be determined according to the actual application scenario, such as M and N in this application).
[0093] See Figure 1 , Figure 1 This is a schematic diagram of the structure of a data prediction network provided by an embodiment of the present application. Figure 1 As shown, the network architecture may include a server 200 and a terminal device cluster, and the terminal device cluster may include one or more terminal devices, and the number of terminal devices is not limited here. Figure 1 As shown, the multiple terminal devices may specifically include terminal device 1, terminal device 2, terminal device 3, ..., terminal device n; Figure 1 As shown, terminal device 1, terminal device 2, terminal device 3, ..., terminal device n can all be connected to the server 200 through a network, so that each terminal device can exchange data with the server 200 through the network connection.
[0094] like Figure 1The server 200 shown can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (content distribution network), and big data and artificial intelligence platforms. The terminal device can be: a smart phone, tablet computer, laptop computer, desktop computer, smart TV, car terminal, smart home terminal, etc. The following takes the communication between the terminal device 1 and the server 200 as an example to describe the embodiment of the present application in detail.
[0095] Among them, the terminal device 1 may have a client (such as a question-and-answer client), which may be any client that can initiate a data prediction request, and the client may be a web client, an application client, or a small program client, etc. The server 200 may be the background server of the client. In the following process, the operations performed by the client may be performed through the terminal device 1 where it is located. The client in the terminal device 1 may receive input (such as user input) query data, which may belong to any business data, and the query data is data that needs to be predicted and processed to obtain corresponding reply data. For example, the query data may be a question, and the reply data corresponding to the query data may be the answer corresponding to the question.
[0096] Therefore, the client can generate a data prediction request based on the query data, and the data prediction request can carry the query data, and the data prediction request is used to request the generation of reply data corresponding to the query data. The client can send the data prediction request to the server 200. After the server 200 receives the data prediction request, it can extract the query data from the data prediction request. The server 200 can call the trained and adjusted language model to perform prediction processing on the query data to generate reply data corresponding to the query data. The server 200 can return the generated reply data to the client, and the client can output (such as display) the received reply data on the client interface for the user to view.
[0097] Therefore, please also refer to Figure 2 , Figure 2 This is a scene diagram of a language model that has been trained and adjusted according to an embodiment of the present application. Figure 2 As shown above Figure 1The server 200 can obtain the target business data, which may include M general business data selected from the general business data set and N vertical business data selected from the vertical business data set, where N and M are both positive integers. The general business data set may contain a large amount of general business data, which may include business data in various general fields; and the vertical business data set may contain multiple vertical business data, which may be business data in a specific vertical field (such as a specific field where the business data that needs to be trained is located). The server 200 can also obtain a language model, which may be a large language model (either single-modal or multi-modal) that has been trained using the general business data set.
[0098] The server 200 may call the language model to perform prediction processing on the target business data to generate prediction gradient information for the target business data. The language model may include multiple network layers to be screened (i.e., multiple network layers to be screened that require model parameter adjustment), and the prediction gradient information may be used to reflect the discrimination of the prediction results of the target business data by the multiple network layers. The prediction gradient information may include first prediction gradient information corresponding to M general business data and second prediction gradient information corresponding to N vertical domain business data.
[0099] The server 200 can use the first prediction gradient information and the second prediction gradient information to select a target network layer from the multiple network layers for model parameter adjustment, where the target network layer has a greater degree of differentiation between its prediction results for M general business data and its prediction results for N general business data than other network layers in the multiple network layers. Therefore, the server 200 can train the language model using the vertical domain business dataset to fine-tune the model parameters of the target network layer in the language model, thereby training and obtaining an adjusted language model.
[0100] Through the method provided in this application, the target network layer that needs to be directionally adjusted in the model parameters can be screened out from the language model through the first prediction gradient information of the language model for general business data and the second prediction gradient information for vertical business data. Then, by adjusting the model parameters of the target network layer in a directional manner through the vertical business data set, more accurate fine-tuning training for the entire language model can be achieved to improve the accuracy of the adjusted language model obtained by training, and ensure that the adjusted language model has the performance of predicting and processing general business data and vertical business data at the same time, and can accelerate the speed of fine-tuning training of the language model and improve the efficiency of fine-tuning training of the language model.
[0101] See Figure 3 , Figure 3This is a flow chart of a data processing method provided by an embodiment of the present application. The execution subject in the embodiment of the present application can be a data processing device (which can be referred to as a processing device), and the processing device can be a computer device or a computer device cluster composed of multiple computer devices. The computer device can be a server, a terminal device, or other devices, and this application does not limit this. Figure 3 As shown, the method may include:
[0102] Step S101, obtaining target business data; the target business data includes M general business data selected from the general business data set, and N vertical business data selected from the vertical business data set, where M and N are both positive integers.
[0103] In one embodiment, the processing device can obtain target business data (i.e., selected business data), which may include M general business data selected from the general business data set and N vertical business data selected from the vertical business data set. Wherein, M and N are both positive integers, and the specific values of M and N can be set according to the actual application scenario.
[0104] The general business data set may include business data of various general fields (or various business types). The business data contained in the general business data set may be large in number, that is, the general business data set may contain a large amount of business data of various general fields. The business data contained in the general business data set may be referred to as general business data. The vertical domain business data set may include business data of a specified field (or a specified business type, such as a specified specific field / business type). The business data contained in the vertical domain business data set may be referred to as vertical domain business data. The number of vertical domain business data contained in the vertical domain business data set may generally be less than the number of general business data in the general business data set. Therefore, M may generally be set to a value greater than N.
[0105] The data format (such as data form) of the general business data in the above-mentioned general business data set and the vertical domain business data in the vertical domain business data set can be the same, except that the fields / types of the business data contained are different. For example, both the general business data and the vertical domain business data can be in the format of video plus text, or in the format of image plus text, and so on. That is, the general business data and the vertical domain business data in this application can be multimodal (such as a modality including video and a modality including text, or a modality including image and text) business data, then correspondingly, the following language model in this application can also be a multimodal language model (such as a multimodal large language model, which can be referred to as a multimodal large model). In actual applications, the input data of the multimodal language model (such as input business data) can also be unimodal. Alternatively, in some implementation scenarios, the general business data and the vertical domain business data in this application can also be unimodal (such as text modality) business data, and similarly, the following language model in this application can also be a unimodal language model (such as a unimodal large language model, which can be referred to as a large language model). The data format of the business data in this application and the specific modal types processed by the language model can be determined according to actual application requirements, and this application does not impose any restrictions on this.
[0106] Therefore, it can be understood that the above-mentioned M general business data can be M business data selected from the general business data set and can be used to represent the entire general business data set as a whole. Similarly, the above-mentioned N vertical domain business data can be N business data selected from the vertical domain business data set and can be used to represent the entire vertical domain business data set as a whole. The business data in this application (such as general business data / vertical domain business data) can all be inquiry data. In this application, it is necessary to predict and generate the response data corresponding to the inquiry data. The inquiry data can be understood as a question, and the response data corresponding to the inquiry data can be understood as the answer to the question.
[0107] For example, the method of selecting the above-mentioned M general business data from the general business data set and the method of selecting the above-mentioned N vertical business data from the vertical business data set may include but is not limited to the following method, as described in the following content.
[0108] The above-mentioned general business data set may contain multiple general business data. The process of selecting the above-mentioned M general business data from the general business data set may include: the processing device may perform feature conversion processing on each general business data in the general business data set to generate a feature vector for each general business data in the general business data set. One general business data may have a corresponding feature vector, such as the feature vector may be a 256-dimensional vector.
[0109] In one embodiment, the processing device may obtain a data feature encoder, which may be a pre-trained network model that can be used to perform feature conversion processing on service data to generate feature vectors for the service data. Therefore, the processing device may invoke the data feature encoder to perform feature conversion processing on each piece of general service data in the general service data set to generate a feature vector for each piece of general service data.
[0110] For example, a general service data may be a video data plus a piece of text data. The text data may be a question or an instruction regarding the video data, used to indicate the direction (or purpose) of the language model's prediction of the video data. Then, the data feature encoder may be a video feature encoder, and the processing device may call the video feature encoder to perform feature encoding processing (i.e., feature conversion processing) on the video data in the general service data to generate video encoding features of the video data. The video encoding features may be directly used as a feature vector representing the general service data, i.e., a feature vector of general service data may be generated using the video data in the general service data.
[0111] In one embodiment, the process of the processing device invoking a data feature encoder to perform feature encoding processing on the video data to generate the video coding feature may include: selecting Q video frames (Q image data) from the video data, where Q is a positive integer and the value of Q can be set according to the actual application scenario, such as Q can be equal to 6. The method of selecting the Q video frames can also be determined according to the actual application scenario, such as the Q video frames can be the first Q video frames in the video data, or the Q video frames can be uniformly sampled from the video data at a uniform sampling interval (such as every P frame), or the Q video frames can be randomly sampled from the video data, etc. The processing device can invoke the data feature encoder to perform feature encoding processing on the Q video frames to generate coding features for each of the Q video frames, and can invoke the data feature encoder to perform feature fusion processing on the Q coding features of the Q video frames (such as by performing attention-weighted fusion through an attention network layer, or by averaging the Q coding features to achieve fusion) to generate the video coding feature of the video data.
[0112] Alternatively, the data feature encoder may include a video feature encoder and a text feature encoder. The processing device may call the video feature encoder to perform feature encoding processing on the video data in the general service data to generate video encoding features (which may be a feature vector) of the video data. The processing device may also call the text feature encoder to perform feature encoding processing on the text data in the general service data to generate text encoding features (which may also be a feature vector) of the text data. The processing device may combine (e.g., concatenate) the text encoding features and the video encoding features to generate a feature vector representing the entire general service data.
[0113] For example, the data feature encoder can be a VideoCLIP model (a large model for text-to-video processing). The VideoCLIP model can include a video encoding module and a text encoding module. The video feature encoder can be the video encoding module in the VideoCLIP model, and the text feature encoder can be the text encoding module in the VideoCLIP model. Alternatively, the data feature encoder can be another network model. The specific data feature encoder can be selected based on actual business needs.
[0114] For another example, similarly, if a general business data is an image data and a piece of text data, then the above-mentioned data feature encoder can be an image feature encoder, or the data feature encoder can include an image feature encoder and a text feature encoder at the same time. The processing device can call the image feature encoder to perform feature encoding processing on the image data to generate image encoding features of the image data, and can use the image encoding features as the feature vector of the general business data. Alternatively, the processing device can call the image feature encoder to perform feature encoding processing on the image data to generate image encoding features of the image data, and can call the text feature encoder to perform feature encoding processing on the text data to generate text encoding features of the text data. The processing device can combine the image encoding features and the text encoding features (such as splicing processing) to obtain the feature vector of the general business data.
[0115] Specifically, how to generate the feature vector of the general business data can be determined according to the actual application scenario.
[0116] The processing device can perform a first clustering process on the general business data in the general business data set using the feature vector of each general business data to obtain a first clustering result for the general business data in the general business data set. The first clustering process can be an M-type clustering process for the general business data in the general business data set. Therefore, the first clustering result can include M first clustering clusters obtained by clustering the general business data in the general business data set. For example, the present application can be the above-mentioned first clustering process implemented by adopting the k-means algorithm (an unsupervised clustering algorithm) to obtain the above-mentioned M first clustering clusters.
[0117] For example, performing a first clustering process on the general service data in the general service data set to obtain a first clustering result may include: the processing device may randomly select M initial general service data from the general service data set, where the M initial general service data may be any M general service data in the general service data set. Feature vectors of the M initial general service data may serve as M initial cluster centers (also called centroids) for clustering, and each initial cluster center may correspond to a cluster to be clustered.
[0118] The processing device can assign each general service data in the general service data set to the cluster corresponding to the initial cluster center with the closest characteristic distance (such as the Euclidean distance between the characteristic vectors), thereby obtaining M clusters of the first clustering. For example, for a general service data, the characteristic distance (which can be the Euclidean distance) between the characteristic vector of the general service data and each initial cluster center can be calculated, and the general service data can be assigned to the cluster corresponding to the initial cluster center with the closest characteristic distance between the characteristic vector and the general service data.
[0119] After obtaining the M clusters of the first clustering, the processing device can recalculate the cluster center of each cluster of the first clustering. The cluster center of a cluster can be the feature vector obtained by averaging the feature vectors of each general business data in the cluster. Similarly, a cluster center can correspond to a cluster that needs to be clustered. In addition, the above-mentioned allocation steps can be repeated for the general business data in the general business data set, that is, each general business data in the general business data set can be allocated to the cluster corresponding to the cluster center with the closest feature distance to its feature vector (the cluster center of the cluster of the first clustering), thereby obtaining the M clusters of the second clustering.
[0120] Similarly, the processing device can recalculate the cluster center of each cluster of the second clustering. The cluster center of a cluster can be the feature vector obtained by averaging the feature vectors of each general business data in the cluster. Similarly, a cluster center can correspond to a cluster that needs to be clustered. In addition, the above-mentioned steps of allocating the general business data in the general business data set can be repeated, that is, each general business data in the general business data set can be allocated to the cluster corresponding to the cluster center (the cluster center of the cluster of the second clustering) with the shortest feature distance between its feature vector, thereby obtaining M clusters of the third clustering. Similarly, the processing device can iteratively update the M cluster centers in accordance with the above logic for multiple rounds, and perform multiple rounds of reallocation of each general business data in the general business data set through the updated M cluster centers to finally obtain the above-mentioned M first clusters.
[0121] For example, the conditions for stopping the next round of iterative allocation for each general service data in the general service data set may be: the number of iterative allocation rounds is equal to a set round threshold, or the change in the M cluster centers obtained by the latest update compared to the M cluster centers obtained by the previous update is less than a set change threshold, etc. The change may refer to the characteristic distance (such as Euclidean distance) between the M cluster centers obtained by the latest update and the M cluster centers obtained by the previous update, and the characteristic distance may refer to the maximum characteristic distance between the M cluster centers obtained by the latest update and the M cluster centers obtained by the previous update, or the average characteristic distance.
[0122] Among them, each first cluster can contain at least one general business data clustered in the general business data set, and different first clusters may not contain the same general business data. The at least one general business data clustered in each first cluster can be general business data with relatively similar corresponding feature vectors. It can be understood that the above-mentioned M first clusters are based on the similarity between the general business data in the general business data set (which can be reflected by the similarity between the feature vectors of the general business data), and divide the general business data in the general business data set into M general business data groups.
[0123] Furthermore, each first cluster may have its own cluster center, and the cluster center of each first cluster may be used to represent the overall data features of the general business data in each first cluster.
[0124] The cluster center of any first cluster can be the mean vector between the feature vectors of each general business data in the first cluster, that is, the mean vector can be obtained by averaging the feature vectors of each general business data in the first cluster. For example, the dimensions of the feature vectors of each general business data can be the same, and the elements located at the same element position in the feature vectors of each general business data in the first cluster can be averaged to obtain the cluster center of the first cluster. For example, the first element in the cluster center can be obtained by averaging the first element in the feature vectors of each general business data in the first cluster, and the second element in the cluster center can be obtained by averaging the second element in the feature vectors of each general business data in the first cluster, and so on.
[0125] The processing device can select the above-mentioned M general business data from the general business data set through the first clustering result obtained above, including: the processing device can respectively obtain the general business data whose feature vectors are most similar to the corresponding cluster centers in the above-mentioned M first clusters as the above-mentioned M selected general business data. A first cluster can be used to obtain one general business data among the M general business data. In other words, the general business data whose feature vector in a first cluster is most similar to the cluster center of the first cluster can be used as the general business data selected through the first cluster. Therefore, the above-mentioned M general business data can be selected in total through the M first clusters.
[0126] For example, the similarity between vectors can use cosine similarity. Therefore, the processing device can calculate the vector similarity (such as cosine similarity) between the feature vectors of each general business data in a first cluster and the cluster center of the first cluster. The processing device can use the general business data with the greatest vector similarity between the feature vector in the first cluster and the cluster center of the first cluster as the general business data in the first cluster whose feature vector is most similar to the cluster center of the first cluster, and select the general business data.
[0127] Since the M general business data are obtained by clustering the M first clusters based on the similarity between the general business data, a first cluster can be used to reflect one aspect of the data characteristics of the general business data in the general business data set. Therefore, the M general business data selected by the M first clusters can be used to reflect the M aspects of the data characteristics of the general business data in the general business data set, that is, the M general business data selected in this way can be used to represent the entire general business data set as a whole. The feature distribution between the feature vectors of the M general business data is extremely similar to the feature distribution between the feature vectors of the general business data in the entire general business data set (that is, roughly the same). It can also be understood that the data distribution of the M general business data is extremely close to the data distribution of each general business data in the general business data set.
[0128] Similar to the principle of selecting the above-mentioned N general business data from the general business data set, the above-mentioned vertical business data set may also contain multiple vertical business data. The process of selecting the above-mentioned N vertical business data from the vertical business data set may include: the processing device may perform feature conversion processing on each vertical business data in the vertical business data set to generate a feature vector for each vertical business data in the vertical business data set. One vertical business data may have a corresponding feature vector, such as the feature vector may be a 256-dimensional vector.
[0129] Among them, the principle of the processing device generating the characteristic vector of each vertical domain business data is the same as the principle of generating the characteristic vector of each general business data mentioned above, and will not be repeated here.
[0130] The processing device may perform a second clustering process on the vertical service data in the vertical service data set using the feature vector of each vertical service data to obtain a second clustering result for the vertical service data in the vertical service data set. The second clustering process may be an N-type clustering process on the vertical service data in the vertical service data set. Therefore, the second clustering result may include N second cluster clusters obtained by clustering the vertical service data in the vertical service data set.
[0131] Here, the principle of performing the second clustering process on the vertical domain business data in the vertical domain business data set to obtain the second clustering result is the same as the principle of performing the first clustering process on the general business data in the general business data set to obtain the first clustering result. For example, it can also be implemented using the k-means algorithm, except that the number of cluster centers here is N instead of M. Therefore, the process of clustering the vertical domain business data in the vertical domain business data set to obtain the second clustering result will not be repeated here.
[0132] Among them, each second cluster may include at least one vertical business data clustered in the vertical business data set, and different first clusters may not contain the same vertical business data. The at least one vertical business data clustered in each second cluster may be vertical business data with relatively similar corresponding feature vectors. It can be understood that the above-mentioned N second clusters are based on the similarity between the vertical business data in the vertical business data set (which can be reflected by the similarity between the feature vectors of the vertical business data), and divide the vertical business data in the vertical business data set into N vertical business data groups.
[0133] Likewise, each second cluster may have its own cluster center, and the cluster center of each second cluster may be used to represent the overall data features of the vertical domain service data in each second cluster.
[0134] The cluster center of any second cluster can be the mean vector between the feature vectors of each vertical business data in any second cluster, that is, the mean vector can be obtained by averaging the feature vectors of each vertical business data in any second cluster. For example, the dimensions of the feature vectors of each vertical business data can be the same, and the elements located at the same element position in each feature vector of each vertical business data in any second cluster can be averaged to obtain the cluster center of any second cluster, such as the first element in the cluster center can be obtained by averaging the first element in each feature vector of each vertical business data in any second cluster, the second element in the cluster center can be obtained by averaging the second element in each feature vector of each vertical business data in any second cluster, and so on.
[0135] The processing device can select the above-mentioned N vertical business data from the vertical business data set through the second clustering result obtained above, including: the processing device can respectively obtain the vertical business data whose feature vectors are most similar to the corresponding cluster centers in the above-mentioned N second clusters as the above-mentioned N selected vertical business data. A second cluster can be used to obtain one vertical business data among the N vertical business data. In other words, the vertical business data whose feature vector in a second cluster is most similar to the cluster center of the second cluster can be used as a vertical business data selected through the second cluster. Therefore, the above-mentioned N vertical business data can be selected in total through the N second clusters.
[0136] For example, the similarity between vectors can use cosine similarity. Therefore, the processing device can calculate the vector similarity (such as cosine similarity) between the characteristic vectors of each vertical business data in a second cluster and the cluster center of the second cluster. The processing device can use the vertical business data with the greatest vector similarity between the characteristic vector in the second cluster and the cluster center of the second cluster as the vertical business data with the characteristic vector in the second cluster that is most similar to the cluster center of the second cluster, and select the vertical business data.
[0137] In addition, since the N vertical business data are obtained by clustering the N second clusters based on the similarity between the vertical business data, a second cluster can be used to reflect one aspect of the data characteristics of the vertical business data in the vertical business data set. Therefore, the N vertical business data selected by the N second clusters can be used to reflect the N aspects of the data characteristics of the vertical business data in the vertical business data set, that is, the N vertical business data selected in this way can be used to represent the entire vertical business data set as a whole, and the feature distribution between the feature vectors of the N vertical business data is extremely similar (that is, roughly the same) to the feature distribution between the feature vectors of the vertical business data in the entire vertical business data set. It can also be understood that the data distribution of the N vertical business data is extremely close to the data distribution of each vertical business data in the vertical business data set.
[0138] Step S102: Call the language model to perform prediction processing on the target business data and obtain prediction gradient information; wherein, the language model includes multiple network layers to be screened, and the prediction gradient information is used to indicate the discrimination of the prediction results of the target business data by multiple network layers, and the prediction gradient information includes the first prediction gradient information corresponding to M general business data and the second prediction gradient information corresponding to N vertical domain business data.
[0139] In one embodiment, the language model in this application can be a large language model. The language model can be a model that has been trained using a general business data set, that is, the language model has learned and has the ability to accurately predict general business data. This application can continue to fine-tune the trained language model using vertical business data to improve the accuracy of the language model's prediction of vertical business data, as described below.
[0140] The processing device can call the language model to perform predictive processing on the target business data to obtain the predicted gradient information for the target business data. The language model may include multiple network layers to be screened, and the multiple network layers to be screened may be multiple key network layers determined from the full network layer (i.e., all network layers) contained in the language model. For example, the multiple key network layers may be multiple FFN layers (Feed-Forward Network, feedforward neural network) contained in the language model. The FFN layer is the core network layer in the language model and assumes the core function. In this application, a network layer that can be fine-tuned through a vertical domain business data set can be selected from the multiple key network layers.
[0141] The above-mentioned prediction gradient information may include the first prediction gradient information corresponding to the above-mentioned M general business data. The first prediction gradient information may include the average gradient information of the M general business data as a whole at each key network layer (which may be called the first average gradient information). The M general business data may have a first average gradient information at a key network layer. The first average gradient information of the M general business data at a key network layer can be used to reflect the gradient information of the prediction processing of the M general business data as a whole at the key network layer.
[0142] In addition, the above-mentioned prediction gradient information may include the second prediction gradient information corresponding to the above-mentioned N vertical domain business data, and the second prediction gradient information may include the average gradient information of the N vertical domain business data as a whole at each key network layer (which may be called the second average gradient information). The N vertical domain business data may have a second average gradient information at a key network layer, and the second average gradient information of the N vertical domain business data at a key network layer can be used to reflect the gradient information of the prediction processing of the N vertical domain business data as a whole at the key network layer.
[0143] That is, a key network layer can correspond to a first average gradient information and a second average gradient information. The first average gradient information corresponding to a key network layer can be used to reflect the gradient information of the above-mentioned M general business data as a whole being predicted and processed at the key network layer, and the second average gradient information corresponding to a key network layer can be used to reflect the gradient information of the above-mentioned N vertical domain business data as a whole being predicted and processed at the key network layer.
[0144] In one embodiment, the process of the processing device calling the language model to obtain the above-mentioned first prediction gradient information may include: the processing device may input the above-mentioned M selected general business data into the language model to call the language model to perform prediction processing on each of the M general business data respectively, and may generate gradient information (which may be called general gradient information) for each general business data in multiple key network layers. One general business data may have one general gradient information in one key network layer.
[0145] Any one of the M general service data selected above can be called target general service data. The following is a specific explanation using the process of obtaining the general gradient information of the target general service data at each key network layer as an example, as described below.
[0146] For example, the processing device can call the language model to perform prediction processing on the target general business data, and can generate a predicted loss value for the target general business data, which can be referred to as a first predicted loss value. For example, the processing device can call the language model to perform prediction processing on the target general business data to predict and generate response data corresponding to the target general business data (which can be referred to as predicted response data). The target general business data can also have label information, and the label information can be used to indicate the reference response data corresponding to the target general business data. The reference response data is the response data that is ideally expected to be predicted for the prediction processing of the target general business data, that is, the reference response data can be understood as the correct answer for the prediction processing of the target general business data. In addition, the language model can have its own loss function (that is, the loss function used for model training and parameter correction). The processing device can substitute the reference response data and the predicted response data corresponding to the target general business data into the loss function to obtain the first predicted loss value of the language model for the target general business data.
[0147] The processing device can start from the last network layer of the language model, and sequentially proceed layer by layer to perform derivative processing on the first predicted loss value at each network layer of the language model, so as to obtain the gradient information of the target general business data at each network layer of the language model, wherein, since the multiple network layers to be screened in this application are multiple key network layers in the language model, therefore, when the first predicted loss value is sequentially performed at each network layer of the language model, until the derivative processing of the first predicted loss value is completed at each of the multiple key network layers, it is possible to stop continuing to perform derivative processing on the first predicted loss value at the previous network layer, because at this time, the general gradient information of the target general business data at each key network layer can be obtained. The derivative processing of the first predicted loss value at a network layer can be performed by deriving the first predicted loss value through the model parameters (also referred to as network parameters) of the network layer.
[0148] For example, the language model may include, from back to front, network layer w1, network layer w2, network layer w3, network layer w4, and network layer w5, and the aforementioned multiple key network layers of the language model include network layer w2 and network layer w3. Therefore, the processing device can perform a derivative process on the first predicted loss value using the model parameters of network layer w1 to obtain general gradient information t1 of the target general service data at network layer w1; the processing device can also perform a derivative process on the general gradient information t1 using the model parameters of network layer w2 to obtain general gradient information t2 of the target general service data at network layer w2; and the processing device can continue to perform a derivative process on the general gradient information t2 using the model parameters of general network layer w3 to obtain general gradient information t3 of the target general service data at network layer w3; at this point, the derivative process of the first predicted loss value can be stopped because the general gradient information t2 of the target general service data at key network layer w2 and the general gradient information t3 of the target general service data at key network layer w3 have been obtained. That is to say, except for the last network layer in the language model, which directly derives the first prediction loss value, the other network layers in the language model can be realized by deriving the gradient information obtained by the previous derived network layer to achieve the derivation of the first prediction loss value.
[0149] The processing device can obtain the general gradient information of each of the M selected general service data at each key network layer in the same principle as above. As shown in the following formula, the general gradient information q of the target general service data at any key network layer is obtained. y It can also be expressed as:
[0150]
[0151] Among them, L s represents the loss function of the language model, h1 represents the predicted response data generated by calling the language model to predict the target general business data, and h2 represents the reference response data corresponding to the target general business data. Therefore, L s (h1, h20 can represent the predicted loss value obtained by predicting the target general business data. It means that the predicted loss value is derivatized at any key network layer.
[0152] The processing device can perform an average calculation on the general gradient information of the M general business data in each key network layer to obtain the first average gradient information corresponding to each key network layer. For example, the processing device can perform an average calculation on the M general gradient information of the M general business data in any key network layer (such as the dimensions of the M general gradient information can be the same, or the elements at the same element position in the M general gradient information can be averaged) to generate the first average gradient information corresponding to the key network layer. As shown in the following formula, the first average gradient information G corresponding to any key network layer is calculated. x It can also be expressed as:
[0153]
[0154] Where x represents any key network layer, j is a positive integer less than or equal to M, g j It represents the general gradient information (which can be a gradient matrix) of the j-th general service data among the above M general service data at any key network layer.
[0155] Therefore, the processing device can obtain the first average gradient information corresponding to the above-mentioned multiple key network layers according to the principles described above, and the obtained first predicted gradient information can include multiple first average gradient information corresponding to the multiple key network layers.
[0156] Similarly, in one embodiment, the process of the processing device calling the language model to obtain the above-mentioned second prediction gradient information may include: the processing device may input the above-mentioned N selected vertical domain business data into the language model to call the language model to perform prediction processing on each of the N vertical domain business data respectively, and may generate gradient information (which may be called vertical domain gradient information) for each vertical domain business data in multiple key network layers. One vertical domain business data may have one vertical domain gradient information in one key network layer.
[0157] Any one of the N vertical service data selected above can be called target vertical service data. The following is a specific explanation using the process of obtaining the vertical gradient information of the target vertical service data at each key network layer as an example, as described below.
[0158] For example, the processing device can call the language model to perform prediction processing on the target vertical domain business data, and can generate a predicted loss value for the target vertical domain business data, and the predicted loss value can be referred to as the second predicted loss value. For example, the processing device can call the language model to perform prediction processing on the target vertical domain business data to predict and generate response data (also referred to as predicted response data) corresponding to the target vertical domain business data. The target vertical domain business data can also have label information, and the label information can be used to indicate the reference response data corresponding to the target vertical domain business data. The reference response data is the response data that is ideally desired to be predicted for the prediction processing of the target vertical domain business data, that is, the reference response data can be understood as the correct answer to the prediction processing of the target vertical domain business data. In addition, the language model can have its own loss function (that is, the loss function used for model training and parameter correction), and the processing device can substitute the reference response data and the predicted response data corresponding to the target vertical domain business data into the loss function to obtain the second predicted loss value of the language model for the target vertical domain business data.
[0159] Similarly, the processing device can start from the last network layer of the language model, and proceed layer by layer to perform derivative processing on the second predicted loss value at each network layer of the language model, so as to obtain the gradient information of the target vertical domain business data at each network layer of the language model, wherein, since the multiple network layers to be screened in this application are multiple key network layers in the language model, therefore, when the second predicted loss value is derivative processed at each network layer of the language model layer by layer, until the derivative processing of the second predicted loss value is completed in the multiple key network layers, it is possible to stop continuing to derive the second predicted loss value to the previous network layer, because at this time the vertical gradient information of the target vertical domain business data at each key network layer can be obtained. Wherein, the second predicted loss value is derivatized at a network layer, and the second predicted loss value can be derivatized by the model parameters (also referred to as network parameters) of the network layer.
[0160] For example, the language model may include network layer w1, network layer w2, network layer w3, network layer w4 and network layer w5 from back to front, and the above-mentioned multiple key network layers of the language model include the network layer w2 and network layer w3. Therefore, the processing device can perform derivative processing on the second predicted loss value through the model parameters of the network layer w1 to obtain the vertical gradient information t11 of the target vertical service data at the network layer w1; the processing device can also perform derivative processing on the vertical gradient information t11 through the model parameters of the network layer w2 to obtain the vertical gradient information t22 of the target vertical service data at the network layer w2; and, the processing device can continue to perform derivative processing on the vertical gradient information t22 using the model parameters of the general network layer w3 to obtain the vertical gradient information t33 of the target vertical service data at the network layer w3; at this point, the derivative processing of the second predicted loss value can be stopped because the vertical gradient information t22 of the target vertical service data at the key network layer w2 and the vertical gradient information t33 of the target vertical service data at the key network layer w3 have been obtained. Similarly, except that the last network layer in the language model directly performs a derivation process on the second prediction loss value, other network layers in the language model can perform a derivation process on the second prediction loss value by performing a derivation process on the gradient information obtained by the previous derivation network layer.
[0161] The processing device can obtain the vertical gradient information of each of the selected N vertical service data at each key network layer according to the same principle as above for obtaining the vertical gradient information of the target vertical service data at each key network layer.
[0162] The processing device may perform an average calculation on the vertical gradient information of each key network layer for the N vertical service data to obtain the second average gradient information corresponding to each key network layer. For example, the processing device may perform an average calculation on the N vertical gradient information of the N vertical service data at any key network layer (for example, the dimensions of the N vertical gradient information may be the same, or the elements at the same element position in the N vertical gradient information may be averaged) to generate the second average gradient information corresponding to the key network layer.
[0163] Therefore, the processing device can obtain the second average gradient information corresponding to the above-mentioned multiple key network layers according to the principles described above, and the obtained second predicted gradient information can include multiple second average gradient information corresponding to the multiple key network layers.
[0164] The principle of obtaining the general gradient information of general business data in the key network layer is the same as the principle of obtaining the vertical domain business gradient information of vertical domain business data in the key network layer, and the principle of calculating the first average gradient information corresponding to the key network layer is the same as the principle of calculating the second average gradient information corresponding to the key network layer. Therefore, the generation principles of the two described above can refer to each other. The general gradient information and vertical domain gradient information can both be the back propagation gradient when the corresponding business data is predicted in the language model.
[0165] Step S103: Based on the first prediction gradient information and the second prediction gradient information, a target network layer is selected from multiple network layers of the language model; the target network layer has a higher degree of differentiation between the prediction results of N vertical domain business data and the prediction results of M general business data than other network layers in the multiple network layers.
[0166] In one embodiment, the processing device can use the first prediction gradient information and the second prediction gradient information obtained above to screen out a target network layer that requires model parameter adjustment from multiple network layers to be screened (such as multiple key network layers) of the language model. The target network layer can have one or more target network layers. The degree of differentiation between the prediction results of the target network layer for N vertical domain business data and the prediction results for M general business data will be higher than that of other network layers in the multiple network layers except the target network layer.
[0167] Among them, the prediction result of a network layer for a business data (such as vertical business data or general business data) may refer to: after the business data is input into the language model, the result generated by the network layer for the business data (that is, the output of the network layer), such as the result may be the feature vector or feature matrix generated by the network layer through the input (the input may be the output of the previous network layer of the network layer).
[0168] In other words, the selected target network layer can be the key network layer among the above-mentioned multiple key network layers, in which the distinction (i.e., the difference) between the prediction results generated for vertical domain business data and the prediction results generated for general business data is greater (such as the largest).
[0169] In addition, the target network layer selected in the present application may also be a key network layer that is more sensitive to vertical domain service data than to general service data. For example, this sensitivity may be reflected in the amplitude of the gradient information of the vertical domain service data in the target network layer being greater than the amplitude of the gradient information of the general service data in the target network layer.
[0170] In summary, the target network layer can be a key network layer selected from the above-mentioned multiple key network layers, which has a large degree of distinction between vertical domain business data and general business data, and is more sensitive to vertical domain business data than to general business data.
[0171] Therefore, after adjusting (i.e., training) the model parameters of the target network layer in the language model through the vertical domain business data set, not only can the accuracy of the language model in predicting the vertical domain business data be improved, but also the original prediction accuracy of the language model for general business data can be guaranteed. That is, when the language model is trained through the vertical domain business data set, the present application can improve the accuracy of the language model in predicting the vertical domain business data without weakening the original accuracy of the language model in predicting the general business data, thereby ensuring that the trained language model has the ability to accurately predict both the vertical domain business data and the general business data.
[0172] The specific process of how the processing device selects the target network layer from the above multiple network layers can be found in the following Figure 6 Corresponding description in the corresponding embodiment.
[0173] Step S104: Use the vertical domain business data set to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model. The adjusted language model is used to output corresponding reply data according to the input business data.
[0174] In one embodiment, the processing device may use the above-mentioned vertical domain business data set as a training data set for training the language model (i.e., fine-tuning the model parameters), or the processing device may also construct a training data set for training the language model through the vertical domain business data set and the above-mentioned selected M general business data. That is to say, in this application, the language model can be fine-tuned only through the vertical domain business data set, or in this application, the language model can be fine-tuned together with the vertical domain business data set and some of the above-mentioned selected general business data (such as the selected M general business data). The selected M general business data are typical selected general business data, which can represent the general business data set as a whole.
[0175] The processing device can use the above-mentioned training data set to fine-tune the language model. When fine-tuning the language model, only the model parameters of the target network layer in the language model can be adjusted, and other model parameters in the language model except the model parameters of the target network layer can be in a frozen state, that is, the other model parameters can participate in the prediction processing of business data, but the other model parameters can remain unchanged without being adjusted.
[0176] By introducing some general business data into the training data set together with the vertical business data set to participate in the fine-tuning training of the language model, it is possible to improve the language model's predictive ability for the vertical business data set while still maintaining a strong adaptability (i.e., adaptability) to accurately predict general business data. Fine-tuning the language model only with the vertical business data set can improve the efficiency of training the language model. Since the target network layer itself is not highly sensitive to the selected general business data, even if the language model is fine-tuned only with the vertical business data set, the language model can still retain its original predictive ability for general business data.
[0177] That is, the processing device can use the above training data set to adjust (i.e., correct) the model parameters of the target network layer in the language model to obtain an adjusted language model. The adjusted language model is also a trained language model. The adjusted language model can subsequently be applied in actual application scenarios for predicting business data to achieve accurate prediction of vertical business data and general business data.
[0178] In one embodiment, the present application uses a training data set to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model. The process may include: the processing device may add a branch network layer to the target network layer of the language model. If there are multiple target network layers, a corresponding branch network layer may be added to each target network layer, that is, a target network layer may be added with a corresponding branch network layer, and the branch network layer may initially have initialized (such as randomly initialized) model parameters. A target network layer and its corresponding branch network layer may be parallel to each other.
[0179] The processing device may train the language model using the training dataset to adjust the model parameters of the newly added branch network layer in the language model, thereby obtaining an adjusted language model. During this training process, all model parameters in the language model, except for the model parameters of the newly added branch network layer, may be frozen, meaning that these other model parameters will not be adjusted but may participate in the prediction of service data.
[0180] That is to say, in the process of training the language model through the training data set (fine-tuning training), the model parameters of the newly added branch network layer can be adjusted without adjusting other model parameters in the language model except the model parameters of the newly added branch network layer (including the original model parameters of the target network layer), that is, the original model parameters of the target network layer can also be in a frozen state.
[0181] Therefore, the model parameters obtained after adjusting the model parameters of the target network layer may include: the original model parameters of the target network layer (i.e., the model parameters that have not been trained through the training data set), and the model parameters after adjusting the model parameters of the branch network layer. That is, in this application, by adding a branch network layer to the target network layer, and then training the language model with the newly added branch network layer through the training data set, it is equivalent to adding the model parameters of the corresponding branch network layer to the target network layer in the language model. That is, adjusting the model parameters of the target network layer can be based on the original model parameters of the target network layer, and adding a part of the model parameters to the target network layer (i.e., the adjusted model parameters of the branch network layer corresponding to the target network layer).
[0182] Among them, since the target network layer and its corresponding branch network layer have a parallel structural relationship, the data originally input into the target network layer (such as the output of the previous network layer of the target network layer) can be input into the branch network layer at the same time. After processing the input data, the target network layer can generate a prediction result (which can be called a first prediction result, such as a feature vector or a feature matrix). After processing the input data, the branch network layer can also generate another prediction result (which can be called a second prediction result, such as a feature vector or a feature matrix). Therefore, the first prediction result and the second prediction result can be fused to obtain the output result of the target network layer with the newly added branch network layer. The output result can be used to input into the next network layer of the target network layer to continue prediction processing. Finally, the response data (i.e., the response result) corresponding to the input business data can be predicted and generated through each network layer in the language model.
[0183] For example, the fusion processing of the first prediction result and the second prediction result may be performed by adding the first prediction result and the second prediction result. For example, the dimension of the first prediction result and the dimension of the second prediction result may be the same. Therefore, elements at the same element position in the first prediction result and the second prediction result may be added to achieve the fusion of the first prediction result and the second prediction result.
[0184] In other words, whether it is the training process of the language model or the application process of the adjusted language model, the original output result of the target network layer can be fused with the output result generated by the branch network layer newly added to the target network layer to obtain the final output result of the target network layer with the newly added branch network layer.
[0185] See Figure 4 , Figure 4 This is a structural diagram of a target network layer after a branch network layer is added to the target network layer according to an embodiment of the present application. Figure 4 As shown, any target network layer is taken as an example for exemplary explanation. In the language model, the target network layer may have other originally connected network layers before it, and the target network layer may have other originally connected network layers after it. Of course, the exemplary illustration here does not exclude the case where the target network layer is the first network layer and / or the second network layer in the language model.
[0186] In the present application, a branch network layer is added to the target network layer, and the branch network layer and the target network layer have a parallel structural relationship. Therefore, the data processing process of the target network layer with the newly added branch network layer can include: the data originally input into the target network layer (such as the output of the previous network layer of the target network layer) can be simultaneously input into the target network layer and the branch network layer corresponding to the target network layer, and the target network layer can generate a first prediction result (which can be a vector or a matrix) by processing the input data, and the branch network layer can generate a second prediction result (which can be a vector or a matrix) by processing the input data. Thus, the first prediction result and the second prediction result can be added to obtain the output result of the target network layer with the newly added branch network layer (i.e., the output data in the figure), and the output result can be used to input into the next network layer of the target network layer for further processing.
[0187] The above-mentioned method of adjusting and training the model parameters of the target network layer in the present application may be to adopt the LoRA method (Low-Rank Adaptation, low-rank adaptation method). Therefore, the parallel branch network layer added to the target network layer in the present application may be a low-rank matrix branch, and the low-rank matrix branch may be composed of two low-rank matrices multiplied together, that is, the model parameters that need to be adjusted and corrected for the target network layer can be represented by the two multiplied low-rank matrices. Among them, the essence of the low-rank matrix is that its information redundancy is high, and the original matrix can be approximated with fewer parameters. Therefore, in the present application, by adding a low-rank matrix branch to the target network layer and adjusting the model parameters of the low-rank matrix branch to achieve the adjustment of the model parameters of the target network layer, the efficiency of adjusting the model parameters of the target network layer can be greatly improved, and the difficulty and amount of calculation for adjusting the model parameters of the target network layer can be reduced.
[0188] It should be noted that the above-mentioned method of adjusting the model parameters of the target network layer by adding a branch network layer to the target network layer is only an exemplary description. In actual application scenarios, any other appropriate method can also be adopted to fine-tune the model parameters of the screened target network layer. This application does not impose any restrictions on this.
[0189] Furthermore, the relevant process of the processing device training and processing the language model through the above-mentioned training data set may include: each business data in the training data set (such as vertical business data or general business data) can have its own label information, and the label information of a business data can be used to indicate the reference response data corresponding to the business data. The reference response data is the ideal response data to be predicted for the prediction processing of the business data, that is, the reference response data can be understood as the correct answer for the prediction processing of the business data.
[0190] The processing device can input the business data in the training data set into the language model (a language model with a newly added branch network layer) to call the language model to perform predictive processing on the input business data to generate predicted response data for the input business data. Thus, the processing device can correct and adjust the model parameters of the newly added branch network layer in the language model based on the difference between the predicted response data and the reference response data corresponding to the input business data. The goal of the correction can be to minimize the difference between the predicted response data and the reference response data corresponding to the input business data (e.g., approach 0).
[0191] For example, the predicted response data and the reference response data corresponding to the input business data can be substituted into the original loss function of the language model to generate a predicted loss value for the input business data. The predicted loss value can be used to reflect the difference between the predicted response data and the reference response data corresponding to the input business data. For example, the larger the predicted loss value, the greater the difference between the predicted response data and the reference response data corresponding to the input business data. Conversely, the smaller the predicted loss value, the smaller the difference between the predicted response data and the reference response data corresponding to the input business data. The model parameters of the newly added branch network layer in the language model can then be adjusted using the predicted loss value, and the goal of the correction can be to minimize the predicted loss value (such as approaching 0).
[0192] The processing device can perform multiple rounds of iterative training on the language model (a language model with a newly added branch network layer) using the business data in the training data set in accordance with the principles described above, so as to finally train the above-mentioned adjusted language model. For example, the stopping condition (i.e., the condition for ending the training) for performing multiple rounds of iterative training on the language model using the training data set may be that the number of rounds of iterative training on the language model is equal to a set round threshold, or that the model parameters of the newly added branch network layer in the language model are trained to a convergence state, or other conditions may be used. The specific conditions may be set according to the actual application business needs, and this application does not impose any restrictions on this.
[0193] See Figure 5 , Figure 5 This is a schematic diagram of a framework of a language model after training and adjustment provided in an embodiment of the present application. Figure 5 As shown, the framework can include three parts, specifically a typical data screening part, a model parameter positioning part, and a model parameter fine-tuning part. For the typical data screening part, the processing device can perform a first clustering process on the general business data in the general business data set to screen out M typical general business data that can represent the entire general business data set from the general business data set; and the processing device can perform a second clustering process on the vertical domain business data in the vertical domain business data set to screen out N typical vertical domain business data that can represent the entire vertical domain business data set from the vertical domain business data set. The screened M general business data and N vertical domain business data can constitute the target business data.
[0194] For the model parameter positioning part, the processing device can call the language model to perform gradient calculation on the above-screened target business data to generate predicted gradient information for the target business data. Thus, the predicted gradient information can be used to screen out the target network layer for model parameter adjustment from the multiple network layers to be screened by the language model. The screened target network layer can be a network layer that is sensitive to vertical domain business data but not to general business data.
[0195] For the above-mentioned model parameter fine-tuning part, the processing device can adjust the model parameters of the target network layer in the language model by means of additional parameter updates. The additional parameter update method can be a method of adding a parallel branch network layer to the target network layer, and the model parameters of the branch network layer belong to the model parameters added to the language model. Therefore, the processing device can adjust the model parameters of the newly added branch network layer in the language model through the vertical domain business data set, so as to finally adjust the model parameters of the target network layer, thereby obtaining the adjusted language model.
[0196] After the above-mentioned adjusted language model is obtained through training, the adjusted language model can be applied to actual data prediction scenarios. The adjusted language model can generate and output corresponding reply data based on the input business data. For example, the input business data can be sent by the client, so the processing device can return the reply data generated for the business data to the client, so that the client can display the reply data on the client interface for the user to view. The business data can be any data that needs to be predicted (such as data combined with pictures and texts, data combined with videos and texts, etc.), and the reply data generated for the business data is the corresponding answer that needs to be predicted and generated for the business data. The business data can be the prompt word (i.e., prompt) of the language model.
[0197] Through the above process, the model parameters of the target network layer selected in the language model are adjusted to obtain the adjusted language model. The adjusted language model not only has the high-precision prediction capability for vertical domain business data, but also retains the original high-precision prediction capability for general business data. Therefore, through the above method of the present application, the effect of fine-tuning the language model using vertical domain business data can be improved, ensuring that the adjusted language model can simultaneously have the high-accuracy prediction and processing capabilities for vertical domain business data and general business data.
[0198] The present application can obtain target business data; the target business data includes M general business data selected from the general business data set and N vertical business data selected from the vertical business data set; and, the language model can be called to perform prediction processing on the target business data to obtain prediction gradient information; wherein, the language model may include multiple network layers to be screened, and the prediction gradient information is used to indicate the discrimination of the multiple network layers for the prediction results of the target business data, and the prediction gradient information may include first prediction gradient information corresponding to the M general business data and second prediction gradient information corresponding to the N vertical business data; therefore, the present application can screen out the target network layer from the multiple network layers of the language model based on the first prediction gradient information and the second prediction gradient information; the discrimination between the prediction results of the N vertical business data and the prediction results of the M general business data of the screened target network layer is higher than that of other network layers in the above-mentioned multiple network layers; thus, the vertical business data set can be used to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model, and the adjusted language model can be used to output corresponding reply data according to the input business data. It can be seen that the method proposed in the present application can obtain the first prediction gradient information of the language model for M general business data and the second prediction gradient information for N vertical business data, and filter the network layer of the language model through the obtained first prediction gradient information and second prediction gradient information, thereby filtering out the target network layer with higher discrimination between the prediction results of the vertical business data and the prediction results of the general business data. When the model parameters of the language model are subsequently adjusted through the vertical business data set, only the model parameters of the target network layer can be adjusted, so as to ensure that the adjusted language model can not only improve the ability to distinguish and predict the vertical business data, but also retain the original ability to distinguish and predict the general business data, thereby improving the accuracy of adjusting the model parameters of the language model.
[0199] See Figure 6 , Figure 6This is a flow chart of a method for screening a target network layer provided by an embodiment of the present application. The embodiment of the present application describes the specific process of screening out a target network layer from multiple network layers to be screened in a language model using the first predicted gradient information and the second predicted gradient information. Figure 6 As shown, the method may include:
[0200] Step S201 , respectively calculating the gradient similarity between the first average gradient information and the second average gradient information corresponding to each key network layer.
[0201] In one embodiment, the multiple network layers to be screened may be multiple key network layers included in the language model. Therefore, the processing device may screen out the target network layer from the multiple key network layers through the first predicted gradient information and the second predicted gradient information, as described below.
[0202] Since the first predicted gradient information can include the first average gradient information of the M general service data as a whole at each key network layer, and the second predicted gradient information can include the second average gradient information of the N vertical domain service data as a whole at each key network layer, that is, one key network layer can correspond to one first average gradient information and one second average gradient information, the processing device can respectively calculate the gradient similarity between the first average gradient information and the second average gradient information corresponding to each key network layer. In other words, for any key network layer, the gradient similarity between the first average gradient information corresponding to the key network layer and the corresponding second average gradient information can be calculated.
[0203] For example, the gradient similarity can be calculated using cosine similarity. The gradient information of any business data (such as any vertical business data or general business data) at any network layer can be a gradient matrix. Therefore, each first average gradient information calculated by the general gradient information of M general business data at each key network layer can be a matrix, and each second average gradient information calculated by the vertical gradient information of N vertical business data at each key network layer can also be a matrix.
[0204] Therefore, a method for calculating the gradient similarity between the first average gradient information and the second average gradient information corresponding to any key network layer can include: considering each row in the first average gradient information as a vector, and considering each row in the second average gradient information as a vector, where a row can be a vector. The dimension of the first average gradient information and the dimension of the second average gradient information can be the same, and the number of rows of the first average gradient information and the number of rows of the second average gradient information can be the same. It is assumed here that the number of rows of the first average gradient information and the number of rows of the second average gradient information are both H, where H is a positive integer. The specific value of H can be determined based on the actual application scenario.
[0205] Therefore, the processing device can calculate the inner product (i.e., dot product) between the first average gradient information and the vectors with the same number of rows in the second average gradient information. Specifically, the inner product between the vector represented by the i-th row in the first average gradient information and the vector represented by the i-th row in the second average gradient information can be calculated, where i is a positive integer less than or equal to H. The calculated inner products can be summed to obtain the gradient inner product between the first average gradient information and the second average gradient information. The processing device can also calculate the product of the amplitude of the first average gradient information and the amplitude of the second average gradient information to obtain the amplitude product of the first average gradient information and the second average gradient information. The amplitude of the first average gradient information can be the norm of the first average gradient information, and the amplitude of the second average gradient information can be the norm of the second average gradient information. The norm can be the square root of the sum of the squares of all elements in a matrix. The processing device can calculate the gradient similarity (i.e., the cosine similarity between the gradients) between the first average gradient information and the second average gradient information corresponding to any of the above-mentioned key network layers by dividing the gradient inner product by the amplitude product. As shown in the following formula, the method for calculating the gradient similarity C(G1, G2) between the first average gradient information and the second average gradient information corresponding to any of the key network layers can also be expressed as:
[0206]
[0207] Among them, G1 can represent the first average gradient information corresponding to any key network layer, and G2 can represent the second average gradient information corresponding to any key network layer.<G1,G2> represents the sum of the inner products between the vectors with the same number of rows in the first average gradient information and the second average gradient information. For example, if H is equal to 3, then<G1,G2> It can be equal to: the inner product between the vector represented by the first row of the first average gradient information and the vector represented by the first row of the second average gradient information + the inner product between the vector represented by the second row of the first average gradient information and the vector represented by the second row of the second average gradient information + the inner product between the vector represented by the third row of the first average gradient information and the vector represented by the third row of the second average gradient information. ‖G1‖ represents the amplitude of the first average gradient information (which can be called the gradient amplitude) and can be the norm of the first average gradient information. ‖G2‖ represents the amplitude of the second average gradient information (which can be called the gradient amplitude) and can be the norm of the second average gradient information.
[0208] The processing device can calculate the gradient similarity between the first average gradient information and the second average gradient information corresponding to each key network layer according to the principle described above. Since the present application calculates the gradient similarity based on the cosine similarity, the gradient similarity corresponding to any key network layer (that is, the gradient similarity between the first average gradient information corresponding to any key network layer and the second average gradient information) can be used to reflect the difference between the gradient direction of the first average gradient information corresponding to any key network layer and the gradient direction of the second average gradient information. The lower the cosine similarity, the greater the difference between the gradient directions. Conversely, the higher the cosine similarity, the smaller the difference between the gradient directions.
[0209] It can be understood that the gradient direction of the first average gradient information corresponding to any key network layer can be used to reflect the direction in which any key network layer predicts and processes the above-mentioned M general business data, and the gradient direction of the first average gradient information can be reflected by the direction of the vector represented by each row in the first average gradient information. Similarly, the gradient direction of the second average gradient information corresponding to any key network layer can be used to reflect the direction in which any key network layer predicts and processes the above-mentioned N vertical domain business data, and the gradient direction of the second average gradient information can be reflected by the direction of the vector represented by each row in the second average gradient information. Therefore, the greater the difference between the gradient direction of the first average gradient information corresponding to any key network layer and the gradient direction of the second average gradient information, the greater the difference between the prediction results of any key network layer for the M general business data and the prediction results for the N vertical domain business data will generally be, that is, the greater the degree of differentiation between the prediction of general business data and vertical domain business data by any key network layer can be.
[0210] Step S202 : sorting the multiple key network layers according to the order of the gradient similarities corresponding to the multiple key network layers from small to large, to obtain a plurality of sorted key network layers.
[0211] In one embodiment, the processing device may sequentially sort the multiple key network layers according to the order from small to large of the gradient similarity calculated for each key network layer, so as to obtain multiple sorted key network layers.
[0212] That is, among the multiple key network layers after the sorting, the key network layer with the smaller corresponding gradient similarity can be arranged at the front, and the key network layer with the larger corresponding gradient similarity can be arranged at the back.
[0213] Step S203 : The top K key network layers among the sorted multiple key network layers are used as K pending network layers, where K is a positive integer.
[0214] In one embodiment, the processing device may use the K key network layers arranged at the front of the plurality of key network layers after the sorting as the K pending network layers. K is a positive integer, and the specific value of K can be set according to actual business needs, such as K can be equal to 5.
[0215] That is, through the above process, K pending network layers with the greatest difference between the direction of prediction for general business data and the direction of prediction for vertical domain business data can be selected from multiple key network layers. The K pending network layers can be the K key network layers with the greatest distinction between the predictions for general business data and vertical domain business data among multiple key network layers.
[0216] Step S204: Filter out the target network layer from the K pending network layers.
[0217] In one embodiment, the processing device may filter out the target network layer from the K pending network layers determined above, as described below.
[0218] The processing device can respectively calculate the difference between the gradient amplitude of the second average gradient information corresponding to each pending network layer and the gradient amplitude of the first average gradient information (which can be called the amplitude difference). That is, for any pending network layer, the gradient amplitude of the second average gradient information corresponding to the any pending network layer can be calculated minus the gradient amplitude of the first average gradient information corresponding to the any pending network layer to obtain the amplitude difference between the gradient amplitude of the second average gradient information corresponding to the any pending network layer and the gradient amplitude of the first average gradient information, which can be simply referred to as the amplitude difference corresponding to the any pending network layer. As shown in the following formula, the amplitude difference A(G11 , G 22 ) can also be expressed as:
[0219] A(G 11 , G 22 )=‖G 22 ‖-‖G 11 ‖ (4)
[0220] Among them, G 11 Indicates the first average gradient information corresponding to any pending network layer, G 22 Represents the second average gradient information corresponding to any undetermined network layer, ‖G 22 ‖ represents the gradient amplitude of the second average gradient information, which can be the norm of the second average gradient information, ‖G 11 ‖ represents the gradient amplitude of the first average gradient information, which can be the norm of the first average gradient information.
[0221] The processing device may sequentially sort the K pending network layers according to the order of the amplitude differences corresponding to the K pending network layers from largest to smallest, to obtain sorted K pending network layers. That is, among the sorted K pending network layers, the pending network layers with larger corresponding amplitude differences may be arranged at the front, and the pending network layers with smaller corresponding amplitude differences may be arranged at the back.
[0222] It can be understood that the larger the gradient amplitude of the first average gradient information corresponding to a pending network layer, the greater the sensitivity of the pending network layer to predicting M general business data, and the larger the gradient amplitude of the second average gradient information corresponding to a pending network layer, the greater the sensitivity of the pending network layer to predicting N vertical domain business data. Therefore, the larger the amplitude difference corresponding to a pending network layer, the greater the sensitivity to predicting N vertical domain business data, and the greater the amplitude of adjustment of model parameters when adjusting parameters through vertical domain business data, while the smaller the sensitivity to predicting M general business data, the smaller the amplitude of adjustment of model parameters when adjusting parameters through general business data. Conversely, the smaller the amplitude difference corresponding to a pending network layer, the smaller the sensitivity to predicting N vertical domain business data, and the greater the sensitivity to predicting M general business data.
[0223] Therefore, each of the K pending network layers after the sorting may be arranged in the order of greater prediction sensitivity to vertical domain service data and smaller prediction sensitivity to general service data.
[0224] The processing device may use the top L pending network layers among the sorted K pending network layers as the screened target network layers, that is, there may be L target network layers to be screened, where L is a positive integer and L is less than K. The specific value of L may be set according to the actual application scenario, such as L may be equal to 2. That is, among the K pending network layers, the L pending network layers with the larger difference between their predicted sensitivity to vertical domain service data and their predicted sensitivity to general service data, and whose predicted sensitivity to vertical domain service data is greater than their predicted sensitivity to general service data, may be used as the screened L target network layers.
[0225] See Figure 7 , Figure 7 This is a schematic diagram of the principle of screening to obtain the pending network layer provided by the embodiment of the present application. Figure 7 As shown, it is assumed that the above-mentioned multiple key network layers include key network layer a1, key network layer a2, key network layer a3, key network layer a4 and key network layer a5, a total of 5 key network layers. Key network layer a1 can correspond to the first average gradient information b1 and the second average gradient information c1. Therefore, the gradient similarity between the first average gradient information b1 and the second average gradient information c1 can be calculated as the gradient similarity d1 corresponding to the key network layer a1; key network layer a2 can correspond to the first average gradient information b2 and the second average gradient information c2. Therefore, the gradient similarity between the first average gradient information b2 and the second average gradient information c2 can be calculated as the gradient similarity d2 corresponding to the key network layer a2; key network layer a3 can correspond to the first average gradient information b3 and the second average gradient information c3. Therefore, the first average gradient can be calculated. The gradient similarity between the information b3 and the second average gradient information c3 is used as the gradient similarity d3 corresponding to the key network layer a3; the key network layer a4 can correspond to the first average gradient information b4 and the second average gradient information c4, therefore, the gradient similarity between the first average gradient information b4 and the second average gradient information c4 can be calculated as the gradient similarity d4 corresponding to the key network layer a4; and, the key network layer a5 can correspond to the first average gradient information b5 and the second average gradient information c5, therefore, the gradient similarity between the first average gradient information b5 and the second average gradient information c5 can be calculated as the gradient similarity d5 corresponding to the key network layer a5.
[0226] The processing device can sequentially sort the key network layers according to the gradient similarities corresponding to the calculated key network layers, from small to large, to obtain a plurality of sorted key network layers. Here, the sorted plurality of key network layers can sequentially include key network layer a1, key network layer a4, key network layer a3, key network layer a2, and key network layer a5. Assuming that the number K of pending network layers to be screened is 3, the processing device can use the first three network layers in the sorted plurality of key network layers as the three screened pending network layers. Here, the three pending network layers include key network layer a1, key network layer a4, and key network layer a3.
[0227] Please also see Figure 8 , Figure 8 This is a schematic diagram of the principle of screening to obtain the target network layer provided in an embodiment of the present application. Figure 8 The corresponding diagram shows the Figure 7 The process of further screening the target network layer from the three undetermined network layers (including the above-mentioned key network layer a1, key network layer a4 and key network layer a3). Figure 8 As shown, the processing device can calculate the amplitude difference e1 obtained by subtracting the amplitude of the first average gradient information b1 from the amplitude of the second average gradient information c1 corresponding to the key network layer a1, and can calculate the amplitude difference e2 obtained by subtracting the amplitude of the first average gradient information b4 from the amplitude of the second average gradient information c4 corresponding to the key network layer a4, and can calculate the amplitude difference e3 obtained by subtracting the amplitude of the first average gradient information b3 from the amplitude of the second average gradient information c3 corresponding to the key network layer a3.
[0228] The processing device may sequentially sort each pending network layer in descending order of their corresponding amplitude differences to obtain K sorted pending network layers. Here, the sorted K pending network layers may include, in order, key network layer a1, key network layer a3, and key network layer a4. Assuming that the number L of target network layers to be screened is 2, the processing device may select the first two pending network layers from the sorted K pending network layers as the two screened target network layers. Here, the two target network layers may include key network layer a1 and key network layer a3.
[0229] Based on the above description, it can be understood that the difference between the first average gradient information and the second average gradient information corresponding to any key network layer can be used to reflect the degree of differentiation between the prediction results of any key network layer for the above-mentioned N vertical domain business data and the prediction results for the M general business data. The greater the difference between the first average gradient information and the second average gradient information corresponding to any key network layer, the greater the degree of differentiation between the prediction results of any key network layer for the above-mentioned N vertical domain business data and the prediction results for the M general business data. Conversely, the smaller the difference between the first average gradient information and the second average gradient information corresponding to any key network layer, the smaller the degree of differentiation between the prediction results of any key network layer for the above-mentioned N vertical domain business data and the prediction results for the M general business data.
[0230] The difference between the first average gradient information and the second average gradient information corresponding to any key network layer may include: the difference between the gradient direction of the first average gradient information corresponding to any key network layer and the gradient direction of the second average gradient information, and the difference between the gradient amplitude of the first average gradient information corresponding to any key network layer and the gradient amplitude of the second average gradient information. The difference between the gradient amplitudes can be reflected by the above-mentioned amplitude difference. The larger the amplitude difference, the greater the difference between the gradient amplitudes.
[0231] Through the above process, the present application can select L target network layers from multiple key network layers of the language model, based on the maximum differentiation between the prediction of vertical domain business data and general business data, the greater the difference between the prediction sensitivity of vertical domain business data and the prediction sensitivity of general business data, and the prediction sensitivity of vertical domain business data is greater than the prediction sensitivity of general business data.
[0232] Therefore, when the present application trains the language model through the vertical business data set, the model parameters of the selected target network layer are adjusted without adjusting the model parameters of other parts of the language model. This can minimize the change in the language model's original ability to accurately predict general business data, and can maximize the language model's ability to accurately predict vertical business data. Therefore, the accuracy of fine-tuning training of the language model is improved, and it can be ensured that the adjusted language model can have the ability to accurately predict both vertical business data and general business data.
[0233] This application can be applied to any scenario of predicting and processing multimodal business data. For example, this application can be applied to video understanding tasks for long videos (such as movies and TV series), including but not limited to the following tasks:
[0234] 1. The task of understanding the advertising points in long videos. In this case, the vertical business data of this application may include a long video and the text "Please identify the video position in the current video that is suitable for inserting advertisements". Therefore, the input long video can be understood by the adjusted language model to identify the video position suitable for inserting advertisements in the long video, that is, the predicted response data generated by the adjusted language model can be a description of the video position in the long video that is suitable for inserting advertisements.
[0235] 2. Understanding video labels for long videos. In this case, the vertical domain business data of this application may include a long video and the text "Please generate a video label suitable for the current video". Therefore, the input long video can be understood by the adjusted language model to identify video labels suitable for the long video. That is, the predicted response data generated by the adjusted language model may include video labels generated for the long video, such as a sweet label, a costume drama label, and so on.
[0236] 3. Understanding tasks for video questions and answers (such as clothing questions and answers, plot questions and answers, etc.) for long videos. In this case, the vertical domain business data of this application may include a long video and a question for the long video, such as "What type of clothing is the character in the current video wearing?", or "What plot is being played in the current video? Please give an overview and generate a plot summary of the current video", or "How many scenes are there in the current video, and which scenes are included?", etc. Therefore, the input long video can be understood by the adjusted language model to generate an answer to the question for the long video.
[0237] The above-mentioned task of video understanding of long videos in this application is only for illustration. It can be understood that this application can be applied to the prediction processing / training processing of any type of vertical domain business data, and the specific details can be determined according to the actual application scenario.
[0238] In the actual video understanding business of long videos, the business scenarios and understanding rules for long videos are becoming more and more complex, and the previous methods of fine-tuning language models often lack the attention to retaining the performance of language models in general fields (that is, the performance of predicting general business data), resulting in a decline in the generalization ability of large models (that is, language models), which hinders the improvement of related businesses. Based on this, the high-performance large model instruction fine-tuning method designed in this application can identify model parameters that are sensitive to vertical domain business data but insensitive to general business data. By updating these model parameters in a targeted manner, a language model that performs well in both general and vertical domains can be obtained, which ultimately promotes business improvement.
[0239] Furthermore, experimental results show that this application demonstrates strong performance in long video understanding. Compared to other strong baseline models, the language model adjusted using the method provided by this application achieves better performance. As shown in the following experimental results:
[0240]
[0241] Table 1
[0242] Among them, the above-mentioned Task 1 is the task of scene recognition for long videos. For this task, this application uses accuracy to evaluate the performance of each model in scene recognition for long videos, including the FT model (a model obtained by using a vertical domain business data set to perform overall training on the language model (that is, all model parameters are involved in the training and will be adjusted)) with an accuracy of 76.2 for scene recognition for long videos, the LT model (a model obtained by adding a corresponding branch network layer to each network layer in the language model for training) with an accuracy of 75.7 for scene recognition for long videos, and the adjusted language model in this application with an accuracy of 75.5 for scene recognition for long videos.
[0243] The above-mentioned Task 2 is the task of video question answering for long videos. For this task, an expert scoring mechanism (scoring range is 1 to 5 points) is used to evaluate the performance of each model for video question answering for long videos, including the FT model's score of 4.2 for video question answering for long videos, the LT model's score of 3.9 for video question answering for long videos, and the language model adjusted in this application's score of 4.0 for video question answering for long videos.
[0244] The above-mentioned task 3 is a general task, which may refer to the task of predicting and processing general business data in a general business data set. For this task, an expert scoring mechanism (scoring range is 1 to 5 points) is also used to evaluate the performance of each model in predicting and processing general business data, including the FT model's score of 3.5 after predicting and processing general business data, the LT model's score of 3.7 after predicting and processing general business data, and the adjusted language model in this application's score of 4.0 after predicting and processing general business data.
[0245] It can be seen that compared with other training methods for language models, the present application has achieved significant improvement in retaining the prediction performance (general performance for short) of general business data, which can prove the effectiveness of the method proposed in this application. The training method of the above-mentioned FT model will train all model parameters, which often causes the large model to shift toward vertical field data, resulting in a decrease in general performance, and the training method of the LT model is between the method provided in this application and the training method adopted by the FT model, which will also cause a decrease in the general performance of the large model. And it can be seen from the above experimental results that in the prediction task of vertical domain business data, the present application can still achieve performance comparable to the LT method, and compared with the FT model, it only brings a small amount of performance degradation, which is negligible for the improvement of general performance.
[0246] This application innovatively proposes a high-performance large model instruction fine-tuning method, which can distinguish model parameters that are sensitive to general domain data (i.e., general business data) and vertical domain data (such as vertical domain business data). By targetedly updating the model parameters that are sensitive to vertical domain data while keeping the model parameters that are sensitive to general domain data unchanged, the performance of the large model (i.e., language model) in predicting vertical domain data can be improved while maintaining the large model's prediction ability for general domain data.
[0247] See Figure 9 , Figure 9 This is a structural diagram of a data processing device provided in an embodiment of the present application. Figure 9 As shown, the data processing device 900 may include: a first acquisition module 9001 , a second acquisition module 9002 , a screening module 9003 and an adjustment module 9004 .
[0248] The first acquisition module 9001 is used to acquire target business data; the target business data includes M general business data selected from the general business data set and N vertical business data selected from the vertical business data set, where M and N are both positive integers;
[0249] The second acquisition module 9002 is configured to call a language model to perform prediction processing on the target service data and obtain prediction gradient information; wherein the language model includes multiple network layers to be screened, and the prediction gradient information is used to indicate the discrimination degree of the prediction results of the multiple network layers for the target service data, and the prediction gradient information includes first prediction gradient information corresponding to M general service data and second prediction gradient information corresponding to N vertical domain service data;
[0250] A screening module 9003 is configured to screen a target network layer from the multiple network layers of the language model based on the first prediction gradient information and the second prediction gradient information; wherein the target network layer has a higher degree of discrimination between prediction results for the N vertical domain service data and prediction results for the M general service data than other network layers in the multiple network layers;
[0251] The adjustment module 9004 is used to adjust the model parameters of the target network layer in the language model using the vertical domain business data set to obtain an adjusted language model, and the adjusted language model is used to output corresponding reply data according to the input business data.
[0252] In one embodiment, the multiple network layers to be screened are multiple key network layers determined from all network layers included in the language model;
[0253] The filtering module 9003 filters out the target network layer from the multiple network layers of the language model based on the first predicted gradient information and the second predicted gradient information, including:
[0254] Based on the first predicted gradient information and the second predicted gradient information, a target network layer is screened out from a plurality of key network layers.
[0255] In one embodiment, the first predicted gradient information includes the first average gradient information of M general service data at each key network layer, and the second predicted gradient information includes the second average gradient information of N vertical domain service data at each key network layer. One key network layer corresponds to one first average gradient information and one second average gradient information;
[0256] The screening module 9003 screens out the target network layer from the multiple key network layers based on the first predicted gradient information and the second predicted gradient information, including:
[0257] Calculate the gradient similarity between the first average gradient information and the second average gradient information corresponding to each key network layer respectively;
[0258] Sorting the multiple key network layers according to the order of the gradient similarities corresponding to the multiple key network layers from small to large to obtain the sorted multiple key network layers;
[0259] The top K key network layers among the sorted multiple key network layers are used as K pending network layers, where K is a positive integer;
[0260] Filter the target network layer from K pending network layers.
[0261] In one embodiment, the method in which the screening module 9003 screens out the target network layer from the K pending network layers includes:
[0262] Calculate the difference between the gradient amplitude of the second average gradient information and the gradient amplitude of the first average gradient information corresponding to each undetermined network layer respectively;
[0263] Sorting the K pending network layers according to the descending order of the amplitude differences corresponding to the K pending network layers to obtain the sorted K pending network layers;
[0264] The first L pending network layers among the sorted K pending network layers are determined as target network layers, where L is a positive integer and L is less than K.
[0265] In one embodiment, the difference between the first average gradient information and the second average gradient information corresponding to any key network layer is used to reflect the distinction between the prediction results of any key network layer for N vertical domain service data and the prediction results for M general service data;
[0266] The difference between the first average gradient information and the second average gradient information corresponding to any key network layer includes: the difference between the gradient direction of the first average gradient information corresponding to any key network layer and the gradient direction of the second average gradient information, and the difference between the gradient amplitude of the first average gradient information and the gradient amplitude of the second average gradient information corresponding to any key network layer;
[0267] The gradient similarity corresponding to any key network layer is used to reflect the difference between the gradient direction of the first average gradient information and the gradient direction of the second average gradient information corresponding to any key network layer.
[0268] In one embodiment, the general service data set includes a plurality of general service data; and the process of the first acquisition module 9001 selecting M general service data from the general service data set includes:
[0269] Performing feature conversion processing on each general business data in the general business data set to generate a feature vector for each general business data;
[0270] performing a first clustering process on the general service data in the general service data set based on the feature vector of each general service data to obtain a first clustering result;
[0271] Based on the first clustering result, M general service data are selected from the general service data set.
[0272] In one embodiment, the first clustering process is an M-type clustering process, and the first clustering result includes M first clusters obtained by clustering the general business data in the general business data set, each first cluster contains at least one general business data clustered in the general business data set, and each first cluster has its own cluster center, and the cluster center of any first cluster is the mean vector between the feature vectors of the general business data in any first cluster;
[0273] The first acquisition module 9001 selects M pieces of general service data from the general service data set based on the first clustering result, including:
[0274] Obtaining respectively the general business data whose feature vectors in the M first clusters are most similar to the corresponding cluster centers as the M general business data;
[0275] A first cluster is used to obtain one general service data among the M general service data.
[0276] In one embodiment, the vertical domain service data set includes multiple vertical domain service data; and the process of the first acquisition module 9001 selecting N vertical domain service data from the vertical domain service data set includes:
[0277] Perform feature conversion processing on each vertical domain service data in the vertical domain service data set to generate a feature vector for each vertical domain service data;
[0278] Performing a second clustering process on the vertical domain service data in the vertical domain service data set based on the feature vector of each vertical domain service data to obtain a second clustering result;
[0279] Based on the second clustering result, N vertical domain business data are selected from the vertical domain business data set.
[0280] In one embodiment, the second clustering process is an N-class clustering process, and the second clustering result includes N second clusters obtained by clustering the vertical domain business data in the vertical domain business data set, each second cluster contains at least one vertical domain business data clustered from the vertical domain business data set, and each second cluster has its own cluster center, and the cluster center of any second cluster is the mean vector between the feature vectors of the vertical domain business data in any second cluster;
[0281] The first acquisition module 9001 selects N vertical domain service data from the vertical domain service data set based on the second clustering result, including:
[0282] Obtaining the vertical service data whose feature vectors in the N second clusters are most similar to the corresponding cluster centers as the N vertical service data;
[0283] Among them, a second cluster is used to obtain one vertical domain business data among N vertical domain business data.
[0284] In one embodiment, the multiple network layers to be screened are multiple key network layers in a language model; the process of the second acquisition module 9002 calling the language model to obtain the first prediction gradient information includes:
[0285] Input M general business data into the language model;
[0286] The language model is called to perform prediction processing on the M input general business data to obtain the general gradient information of the M general business data in multiple key network layers. One general business data has one general gradient information in one key network layer.
[0287] Average the general gradient information of the M general service data at each key network layer to obtain first average gradient information corresponding to each key network layer;
[0288] The first predicted gradient information includes multiple first average gradient information corresponding to multiple key network layers.
[0289] In one embodiment, any one of the M general service data is the target general service data; the second acquisition module 9002 calls the language model to perform prediction processing on the input M general service data to obtain general gradient information of the M general service data at multiple key network layers, including:
[0290] Calling the language model to perform prediction processing on the target general service data to generate a first prediction loss value for the target general service data;
[0291] The first predicted loss value is derivatized at each key network layer to generate universal gradient information of the target universal service data at each key network layer.
[0292] In one embodiment, the multiple network layers to be screened are multiple key network layers in a language model; the process of the second acquisition module 9002 calling the language model to obtain the second prediction gradient information includes:
[0293] Input N vertical domain business data into the language model;
[0294] The language model is called to perform prediction processing on the N input vertical domain service data to obtain the vertical domain gradient information of the N vertical domain service data at multiple key network layers. One vertical domain service data has one vertical domain gradient information at one key network layer.
[0295] Average the vertical gradient information of each key network layer for N vertical service data to obtain the second average gradient information corresponding to each key network layer;
[0296] The second predicted gradient information includes multiple second average gradient information corresponding to multiple key network layers.
[0297] In one embodiment, any one of the N vertical domain service data is target vertical domain service data; the second acquisition module 9002 calls the language model to perform prediction processing on the N vertical domain service data to obtain vertical domain gradient information of the N vertical domain service data at multiple key network layers, including:
[0298] Calling the language model to perform prediction processing on the target vertical domain business data to generate a second predicted loss value for the target vertical domain business data;
[0299] The second predicted loss value is derived at each key network layer to generate vertical gradient information of the target vertical service data at each key network layer.
[0300] In one embodiment, the adjustment module 9004 uses the vertical domain service data set to adjust the model parameters of the target network layer in the language model to obtain the adjusted language model, including:
[0301] Construct a training dataset using the vertical domain business dataset and M general business data;
[0302] The training data set is used to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model.
[0303] In one embodiment, the adjustment module 9004 uses the training data set to adjust the model parameters of the target network layer in the language model to obtain the adjusted language model, including:
[0304] A branch network layer is added to the target network layer of the language model, and the target network layer and the branch network layer are parallel to each other;
[0305] The language model is trained using the training data set to adjust the model parameters of the newly added branch network layer in the language model to obtain an adjusted language model; during the training process, all model parameters in the language model except the model parameters of the newly added branch network layer are frozen;
[0306] The model parameters obtained after adjusting the model parameters of the target network layer include: the original model parameters of the target network layer and the model parameters obtained after adjusting the model parameters of the branch network layer.
[0307] According to one embodiment of the present application, Figure 3 The steps involved in the data processing method shown can be represented by Figure 9 The data processing apparatus 900 shown in FIG. Figure 3 The step S101 shown in FIG. Figure 9 The first acquisition module 9001 is executed, Figure 3 The step S102 shown in FIG. Figure 9 The second acquisition module 9002 is executed; Figure 3 The step S103 shown in FIG. Figure 9 The screening module 9003 in the implementation, Figure 3 The step S104 shown in FIG. Figure 9 The adjustment module 9004 in is used to execute.
[0308] The present application can obtain target business data; the target business data includes M general business data selected from the general business data set and N vertical business data selected from the vertical business data set; and, the language model can be called to perform prediction processing on the target business data to obtain prediction gradient information; wherein, the language model may include multiple network layers to be screened, and the prediction gradient information is used to indicate the discrimination of the multiple network layers for the prediction results of the target business data, and the prediction gradient information may include first prediction gradient information corresponding to the M general business data and second prediction gradient information corresponding to the N vertical business data; therefore, the present application can screen out the target network layer from the multiple network layers of the language model based on the first prediction gradient information and the second prediction gradient information; the discrimination between the prediction results of the N vertical business data and the prediction results of the M general business data of the screened target network layer is higher than that of other network layers in the above-mentioned multiple network layers; thus, the vertical business data set can be used to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model, and the adjusted language model can be used to output corresponding reply data according to the input business data. It can be seen that the device proposed in the present application can obtain the first prediction gradient information of the language model for M general business data and the second prediction gradient information for N vertical business data, and filter the network layer of the language model through the obtained first prediction gradient information and second prediction gradient information, thereby filtering out the target network layer with higher differentiation between the prediction results of the vertical business data and the prediction results of the general business data. When the model parameters of the language model are subsequently adjusted through the vertical business data set, only the model parameters of the target network layer can be adjusted, thereby ensuring that the adjusted language model can not only improve the ability to distinguish and predict the vertical business data, but also retain the original ability to distinguish and predict the general business data, thereby improving the accuracy of adjusting the model parameters of the language model.
[0309] According to one embodiment of the present application, Figure 9 The various modules in the data processing device 900 shown can be separately or all combined into one or several units to constitute, or some of the units (some) can be further split into multiple smaller sub-units in function, and the same operation can be achieved without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In actual applications, the functions of a module can also be implemented by multiple units, or the functions of multiple modules can be implemented by one unit. In other embodiments of the present application, the data processing device 900 may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0310] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0311] According to one embodiment of the present application, a computer program capable of executing the steps involved in the corresponding methods shown in the various embodiments of the present application can be run on a general-purpose computer device (the computer device may include processing elements and storage elements such as a central processing unit (CPU), a random access memory medium (RAM), and a read-only memory medium (ROM)) to construct the following. Figure 9 The data processing apparatus 900 shown in FIG. The computer program may be recorded on a computer-readable recording medium, for example, and may be loaded into the computer device through the computer-readable recording medium and executed therein.
[0312] See Figure 10 , Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 10As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, in some embodiments, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally be at least one storage device located away from the aforementioned processor 1001. As Figure 10 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.
[0313] exist Figure 10 In the computer device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an interface for user input; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0314] Obtain target business data; the target business data includes M general business data selected from the general business data set and N vertical business data selected from the vertical business data set, where M and N are both positive integers;
[0315] Calling a language model to perform prediction processing on the target service data and obtain prediction gradient information; wherein the language model includes multiple network layers to be screened, and the prediction gradient information is used to indicate the discrimination degree of the prediction results of the multiple network layers for the target service data, and the prediction gradient information includes first prediction gradient information corresponding to M general service data and second prediction gradient information corresponding to N vertical domain service data;
[0316] Based on the first prediction gradient information and the second prediction gradient information, a target network layer is selected from multiple network layers of the language model; the target network layer has a higher degree of differentiation between prediction results for the N vertical domain service data and prediction results for the M general service data than other network layers in the multiple network layers;
[0317] The vertical domain business data set is used to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model. The adjusted language model is used to output corresponding response data based on the input business data.
[0318] It should be understood that the computer device 1000 described in the embodiments of the present application can execute the description of the above data processing method in each embodiment of the present application, and can also execute the above Figure 9 The description of the data processing device 900 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here either.
[0319] In addition, it should be noted that the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program. When the processor executes the computer program, it can perform the description of the data processing method in each embodiment of the present application. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0320] As an example, the above-mentioned computer program can be deployed and executed on one computer device, or deployed and executed on multiple computer devices located in one location, or executed on multiple computer devices distributed in multiple locations and interconnected by a communication network. Multiple computer devices distributed in multiple locations and interconnected by a communication network can constitute a blockchain network.
[0321] The computer-readable storage medium may be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may include both an internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0322] The present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device performs the description of the above-mentioned data processing method in each embodiment of the present application. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0323] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.
[0324] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0325] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Obtain target business data; the target business data includes M general business data selected from the general business data set and N vertical business data selected from the vertical business data set, where M and N are both positive integers; Calling a language model to perform prediction processing on the target service data and obtain prediction gradient information; wherein the language model includes multiple network layers to be screened, the prediction gradient information is used to indicate the discrimination degree of the prediction results of the multiple network layers for the target service data, and the prediction gradient information includes first prediction gradient information corresponding to the M general service data and second prediction gradient information corresponding to the N vertical domain service data; Based on the first prediction gradient information and the second prediction gradient information, a target network layer is screened out from the multiple network layers of the language model; the prediction results of the target network layer for the N vertical domain service data and the prediction results for the M general service data have a higher degree of discrimination than other network layers in the multiple network layers; The vertical domain business data set is used to adjust the model parameters of the target network layer in the language model to obtain an adjusted language model, and the adjusted language model is used to output corresponding reply data according to the input business data.
2. The method according to claim 1, wherein The multiple network layers to be screened are multiple key network layers determined from the full set of network layers included in the language model; The step of selecting a target network layer from the plurality of network layers of the language model based on the first predicted gradient information and the second predicted gradient information includes: The target network layer is selected from the multiple key network layers based on the first predicted gradient information and the second predicted gradient information.
3. The method according to claim 2, wherein The first predicted gradient information includes the first average gradient information of the M general service data at each key network layer, and the second predicted gradient information includes the second average gradient information of the N vertical domain service data at each key network layer. One key network layer corresponds to one first average gradient information and one second average gradient information; The selecting the target network layer from the plurality of key network layers based on the first predicted gradient information and the second predicted gradient information includes: Calculating the gradient similarity between the first average gradient information and the second average gradient information corresponding to each key network layer respectively; Sorting the multiple key network layers according to the order of the gradient similarities corresponding to the multiple key network layers from small to large to obtain a plurality of sorted key network layers; The first K key network layers in the sorted plurality of key network layers are used as K pending network layers, where K is a positive integer; The target network layer is selected from the K pending network layers.
4. The method according to claim 3, wherein The step of selecting the target network layer from the K pending network layers includes: Calculate the difference between the gradient amplitude of the second average gradient information and the gradient amplitude of the first average gradient information corresponding to each undetermined network layer respectively; Sorting the K to-be-determined network layers according to the descending order of the amplitude differences corresponding to the K to-be-determined network layers to obtain sorted K to-be-determined network layers; The first L pending network layers among the sorted K pending network layers are determined as the target network layers, where L is a positive integer and L is less than K.
5. The method according to claim 3 or 4, wherein: The difference between the first average gradient information and the second average gradient information corresponding to any key network layer is used to reflect the distinction between the prediction results of any key network layer for the N vertical domain service data and the prediction results for the M general service data; The difference between the first average gradient information and the second average gradient information corresponding to any key network layer includes: the difference between the gradient direction of the first average gradient information corresponding to any key network layer and the gradient direction of the second average gradient information, and the difference between the gradient amplitude of the first average gradient information and the gradient amplitude of the second average gradient information corresponding to any key network layer; The gradient similarity corresponding to any key network layer is used to reflect the difference between the gradient direction of the first average gradient information and the gradient direction of the second average gradient information corresponding to any key network layer.
6. The method according to claim 1, wherein The general service data set includes a plurality of general service data; and the process of selecting the M general service data from the general service data set includes: Performing feature conversion processing on each general service data in the general service data set to generate a feature vector for each general service data; performing a first clustering process on the general service data in the general service data set based on the feature vector of each general service data to obtain a first clustering result; Based on the first clustering result, the M general service data are selected from the general service data set.
7. The method according to claim 6, wherein The first clustering process is an M-type clustering process, the first clustering result includes M first clusters obtained by clustering the general business data in the general business data set, each first cluster contains at least one general business data clustered in the general business data set, and each first cluster has its own cluster center, and the cluster center of any first cluster is a mean vector between the feature vectors of the general business data in any first cluster; The selecting the M general service data from the general service data set based on the first clustering result includes: respectively obtaining, from the M first clusters, general service data whose feature vectors are most similar to the corresponding cluster centers, as the M general service data; A first cluster is used to obtain one general service data among the M general service data.
8. The method according to claim 1, wherein The vertical domain service data set includes multiple vertical domain service data; The process of selecting the N vertical domain service data from the vertical domain service data set includes: Performing feature conversion processing on each vertical domain service data in the vertical domain service data set to generate a feature vector for each vertical domain service data; performing a second clustering process on the vertical domain service data in the vertical domain service data set based on the feature vector of each vertical domain service data to obtain a second clustering result; Based on the second clustering result, the N vertical domain business data are selected from the vertical domain business data set.
9. The method according to claim 8, wherein The second clustering process is an N-class clustering process, and the second clustering result includes N second clusters obtained by clustering the vertical domain business data in the vertical domain business data set, each second cluster contains at least one vertical domain business data clustered from the vertical domain business data set, and each second cluster has its own cluster center, and the cluster center of any second cluster is the mean vector between the feature vectors of the vertical domain business data in any second cluster; The selecting the N vertical domain service data from the vertical domain service data set based on the second clustering result includes: Obtaining vertical service data whose feature vectors are most similar to the corresponding cluster centers in the N second clusters respectively as the N vertical service data; Among them, a second cluster is used to obtain one vertical domain business data among the N vertical domain business data.
10. The method according to claim 1, wherein The multiple network layers to be screened are multiple key network layers in the language model; The process of calling the language model to obtain the first prediction gradient information includes: Inputting the M general business data into the language model; Calling the language model to perform prediction processing on the M general service data input to obtain general gradient information of the M general service data at the multiple key network layers, where one general service data has one general gradient information at one key network layer; Performing average calculation on the general gradient information of each key network layer for the M general service data to obtain first average gradient information corresponding to each key network layer; The first predicted gradient information includes multiple first average gradient information corresponding to the multiple key network layers.
11. The method according to claim 10, wherein Any one of the M general service data is target general service data; the calling of the language model to perform prediction processing on the input M general service data to obtain general gradient information of the M general service data at the multiple key network layers, including: Calling the language model to perform prediction processing on the target general service data to generate a first predicted loss value for the target general service data; The first predicted loss value is derivatized at each key network layer to generate general gradient information of the target general service data at each key network layer.
12. The method according to claim 1, wherein The multiple network layers to be screened are multiple key network layers in the language model; The process of calling the language model to obtain the second prediction gradient information includes: Inputting the N vertical domain service data into the language model; Calling the language model to perform prediction processing on the N vertical domain service data input to obtain vertical domain gradient information of the N vertical domain service data at the multiple key network layers, where one vertical domain service data has one vertical domain gradient information at one key network layer; Performing average calculation on the vertical gradient information of each key network layer for the N vertical service data to obtain second average gradient information corresponding to each key network layer; The second predicted gradient information includes multiple second average gradient information corresponding to the multiple key network layers.
13. The method according to claim 12, wherein: Any one of the N vertical domain service data is target vertical domain service data; the calling of the language model to perform prediction processing on the N vertical domain service data to obtain vertical domain gradient information of the N vertical domain service data at the multiple key network layers, including: Calling the language model to perform prediction processing on the target vertical domain service data to generate a second predicted loss value for the target vertical domain service data; The second predicted loss value is respectively derivatized at each key network layer to generate vertical gradient information of the target vertical service data at each key network layer.
14. The method according to claim 1, wherein The adjusting the model parameters of the target network layer in the language model using the vertical domain service data set to obtain the adjusted language model includes: Constructing a training data set by using the vertical domain service data set and the M general service data; The training data set is used to adjust the model parameters of the target network layer in the language model to obtain the adjusted language model.
15. The method according to claim 14, wherein The adjusting the model parameters of the target network layer in the language model using the training data set to obtain the adjusted language model includes: Adding a branch network layer to the target network layer of the language model, wherein the target network layer and the branch network layer are parallel to each other; Training the language model using the training data set to adjust the model parameters of the newly added branch network layer in the language model to obtain the adjusted language model; during the training process, all model parameters in the language model except the model parameters of the newly added branch network layer are frozen; The model parameters obtained after adjusting the model parameters of the target network layer include: the original model parameters of the target network layer and the model parameters obtained after adjusting the model parameters of the branch network layer.
16. A data processing device, characterized in that: The device comprises: A first acquisition module is configured to acquire target service data; the target service data includes M general service data selected from the general service data set and N vertical service data selected from the vertical service data set, where M and N are both positive integers; a second acquisition module, configured to call a language model to perform prediction processing on the target service data and obtain prediction gradient information; wherein the language model includes multiple network layers to be screened, the prediction gradient information is used to indicate the discrimination degree of the prediction results of the multiple network layers for the target service data, and the prediction gradient information includes first prediction gradient information corresponding to the M general service data and second prediction gradient information corresponding to the N vertical domain service data; a screening module, configured to screen a target network layer from the multiple network layers of the language model based on the first prediction gradient information and the second prediction gradient information; wherein the target network layer has a higher degree of discrimination between prediction results of the N vertical domain service data and prediction results of the M general service data than other network layers in the multiple network layers; An adjustment module is used to adjust the model parameters of the target network layer in the language model using the vertical domain business data set to obtain an adjusted language model, and the adjusted language model is used to output corresponding reply data based on the input business data.
17. A computer program product, characterized in that The computer program product comprises a computer program stored in a computer-readable storage medium. The computer program is suitable for being read and executed by a processor, so as to enable a computer device having the processor to perform the method according to any one of claims 1 to 15.
18. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 15.
19. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the steps of the method according to any one of claims 1 to 15.