Model training method, data processing method and related equipment

By performing feature encoding and multiple dimensionality reduction fusion on sample data, the problem of low efficiency in student model training is solved, and accurate student models can be quickly trained, thereby improving the model training effect and prediction accuracy.

CN120688550AActive Publication Date: 2025-09-23MASHANG CONSUMER FINANCE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510812213.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-09-23
Estimated Expiration
2045-06-16

AI Technical Summary

Technical Problem

In the existing technology, when training the student model, it is necessary to balance the loss relationship between the teacher model and the student model, which leads to low training efficiency and possible loss of knowledge, and it is impossible to quickly train an accurate student model.

Method used

The sample data is feature-encoded through the first model, and the encoding features of the sample data are determined by combining preset prompt words and a second model with a larger number of parameters. The first model is trained through multiple dimensionality reduction and fusion of encoding features to improve its training accuracy and efficiency.

Benefits of technology

It improves the training accuracy and efficiency of the student model, reduces feature loss, enhances the model's convergence speed and training effect, and avoids the need to balance loss relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120688550A_ABST
    Figure CN120688550A_ABST
Patent Text Reader

Abstract

The invention relates to artificial intelligence, and provides a model training method, a data processing method and related equipment. The model training method comprises the steps of performing feature coding on first sample data through a first model to obtain a first coding feature of the first sample data; determining a second coding feature of the first sample data through a second model based on a preset cue word, the parameter quantity of the second model being greater than the parameter quantity of the first model; according to the sample complexity of the first sample data, carrying out multiple times of dimension reduction on the second coding feature to obtain a third coding feature; fusing the first coding feature and the third coding feature to obtain a fourth coding feature; based on the first coding feature and the fourth coding feature, predicting the first sample data through a first model to obtain a prediction result; and training a first model based on the label information of the first sample data and the prediction result. According to the method, the first model can be rapidly and accurately trained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and specifically to a model training method, a data processing method, and related equipment. Background Art

[0002] With the development of artificial intelligence, the scale of neural network models has increased dramatically, leading to a corresponding increase in the computing resources and energy consumption required during inference. To improve inference efficiency, a model with fewer parameters (e.g., the student model) is often trained to mimic the output of a model with a larger number of parameters (e.g., the teacher model). Related technologies typically employ a multi-branch structure to jointly train the student and teacher models. However, this approach requires balancing the loss relationship between the teacher and student models during model training, resulting in inefficient student model training. Therefore, how to quickly train an accurate student model is a hot research topic. Summary of the Invention

[0003] This application provides a model training method, a data processing method and related equipment to solve the technical problem of being unable to quickly train an accurate student model.

[0004] A first aspect of an embodiment of the present application provides a model training method, the method comprising: performing feature encoding on first sample data through a first model to obtain a first encoding feature of the first sample data, the first encoding feature representing a first semantic feature obtained by parsing the first sample data by the first model; determining a second encoding feature of the first sample data through a second model based on a preset prompt word, the parameter amount of the second model being greater than the parameter amount of the first model, the second encoding feature representing a second semantic feature obtained by parsing the first sample data by the second model; performing multiple dimensionality reduction on the second encoding feature according to the sample complexity of the first sample data to obtain a third encoding feature; fusing the first encoding feature and the third encoding feature to obtain a fourth encoding feature, the fourth encoding feature carrying the first semantic feature and the second semantic feature; predicting the first sample data through the first model based on the first encoding feature and the fourth encoding feature to obtain a prediction result; and training the first model based on the label information of the first sample data and the prediction result.

[0005] A second aspect of an embodiment of the present application provides a data processing method, which includes: predicting data through a prediction model to obtain prediction information of the data, and the prediction model is obtained by the model training method described in the first aspect.

[0006] According to a third aspect of an embodiment of the present application, a model training device is provided, comprising: an encoding unit for performing feature encoding on first sample data through a first model to obtain a first encoding feature of the first sample data, wherein the first encoding feature represents a first semantic feature obtained by parsing the first sample data by the first model; a determination unit for determining a second encoding feature of the first sample data through a second model based on a preset prompt word, wherein the parameter amount of the second model is greater than the parameter amount of the first model, and the second encoding feature represents a second semantic feature obtained by parsing the first sample data by the second model; a dimensionality reduction unit for performing multiple dimensionality reduction on the second encoding feature according to the sample complexity of the first sample data to obtain a third encoding feature; a fusion unit for fusing the first encoding feature and the third encoding feature to obtain a fourth encoding feature, wherein the fourth encoding feature carries the first semantic feature and the second semantic feature; a prediction unit for predicting the first sample data through the first model based on the first encoding feature and the fourth encoding feature to obtain a prediction result; and a training unit for training the first model based on the label information of the first sample data and the prediction result.

[0007] A fourth aspect of an embodiment of the present application provides a data processing device, which includes: a prediction module, used to predict data through a prediction model to obtain prediction information of the data, and the prediction model is obtained by the model training method described in the first aspect.

[0008] A fifth aspect of an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method provided in the first or second aspect above when executing the computer program.

[0009] A sixth aspect of an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the method provided in the first or second aspect are implemented.

[0010] A seventh aspect of the embodiments of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps in the method provided in the first or second aspect above.

[0011] In the model training method of this embodiment, the second coding feature of the first sample data is determined by the second model. Since the number of parameters of the second model is greater than the number of parameters of the first model, the second coding feature obtained by the second model can more accurately characterize the first sample data. The second coding feature is subjected to multiple dimensionality reductions according to the sample complexity of the first sample data. Since the second coding feature is not subjected to a one-time dimensionality reduction, the loss of features in the first sample data can be reduced, and the second semantic feature can be effectively retained, thereby improving the training accuracy of the first model. By fusing the first coding feature and the third coding feature of the first sample data, since the fourth coding feature carries the first semantic feature and the second semantic feature, the prediction result of the first sample data is determined based on the fourth coding feature, so that the first model can better learn the features in the first sample data, thereby improving the convergence speed of the first model and improving the training efficiency of the first model. In addition, in the embodiment of the present application, the first model does not need to balance the loss relationship between the first model and the second model during the training process, and therefore, the training effect of the first model can be further improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments of the present application. 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.

[0013] Figure 1 This is a schematic diagram of an application scenario of a model training method and a data processing method provided in an embodiment of the present application; Figure 2 This is a flow chart of a model training method provided in an embodiment of the present application; Figure 3 This is a detailed flow chart of a method for determining a second coding feature of first sample data provided in an embodiment of the present application; Figure 4 This is a schematic diagram of a determination framework of the second coding feature provided in an embodiment of the present application; Figure 5 This is another schematic diagram of a determination framework for the second coding feature provided in an embodiment of the present application; Figure 6 Schematic diagram of the training framework of the first model provided in the embodiment of the present application; Figure 7 This is a flow chart of a data processing method provided by an embodiment of the present application; Figure 8 It is a schematic diagram of the structure of the prediction model provided in the embodiment of the present application; Figure 9 This is a functional module diagram of a model training device provided in an embodiment of the present application; Figure 10 This is a functional module diagram of a data processing device provided in an embodiment of the present application; Figure 11 It is a structural diagram of an electronic device for implementing a model training method and a data processing method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0014] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part 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 creative efforts are within the scope of protection of this application.

[0015] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.

[0016] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application. It should be understood that, unless otherwise specified in this application, " / " means or. For example, A / B can mean A or B. "And / or" in this application is merely a way to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. "At least one" means one or more. "Multiple" means two or more than two. For example, at least one of a, b or c can mean: a, b, c, a and b, a and c, b and c, a, b and c.

[0017] Some terminology explanations: Large models: In the fields of artificial intelligence and deep learning, large models refer to neural network models with large numbers of parameters and complex structures. Large models are typically capable of processing massive amounts of data and completing various complex tasks, such as natural language processing and image recognition.

[0018] Small models: Compared to large models, small models have fewer parameters and lower computational requirements. Small models are simpler in design and implementation, yet still capable of handling specific tasks or problems. The design philosophy of small models is "small but beautiful," minimizing resource consumption while ensuring adequate performance, while maximizing flexibility and scalability. Because small models have fewer parameters and lower computational complexity, they can run on devices with limited hardware resources, such as smartphones and embedded systems.

[0019] Prompt: In natural language generation or text completion tasks, a prompt is a portion of text or a question input to the model, guiding the model to generate text that meets the context and task requirements. A prompt can be a complete sentence or paragraph, or a short question or keyword.

[0020] With the development of artificial intelligence, the scale of neural network models has increased dramatically, leading to a corresponding increase in the computing resources and energy consumption required during inference. To improve inference efficiency, model distillation is often used to transfer knowledge from a large model (often called the teacher model) to a smaller model (often called the student model). This technique trains the student model to mimic the output of the teacher model, enabling the student model to perform inference at a smaller scale while maintaining similar or even better performance than the teacher model, thereby improving inference efficiency.

[0021] Related technologies typically employ a multi-branch structure to jointly train the student model. However, this approach requires balancing the loss relationship between the teacher and student models when training the student model, resulting in inefficient student model training. Furthermore, knowledge from the teacher model may be lost during the model distillation process. Furthermore, because the hidden layer features of the teacher and student models must be compared and matched, this approach requires more computing resources and time to train the student model, increasing computational complexity and time costs.

[0022] Based on the above problems, in order to improve the rapid training of accurate student models, the present application embodiment provides a model training method for improving the training effect of the model. In addition, the present application embodiment also provides a data processing method that can improve the accuracy of data prediction.

[0023] See also Figure 1 , Figure 1Schematic diagram of an application scenario of a model training method and a data processing method provided in an embodiment of the present application. The scenario may include various electronic devices 100 and a server 200.

[0024] The electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device 100.

[0025] Server 200 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, i.e., Content Delivery Network (CDN), as well as big data and artificial intelligence platforms, but is not limited to these.

[0026] It should be noted that the method in the embodiment of the present application can be performed independently by the electronic device 100 or the server 200, or can be performed jointly by the server 200 and the electronic device 100. When performed independently by the electronic device 100 or the server 200, the model training and application processes can be implemented independently by the electronic device 100 or the server 200. For example, the first model can be fine-tuned and trained on the electronic device 100 to obtain a trained first model. Accordingly, after training, the electronic device 100 can use the trained first model to predict data. The above process can also be performed independently by the server 200. When performed jointly by the server 200 and the electronic device 100, the server 200 can train the first model and then deploy the trained first model to the electronic device 100, and the electronic device 100 can implement the data processing process, or part of the model training or application process can be implemented by the electronic device 100, and part of the process can be implemented by the server 200, and the two can cooperate to implement the model training or application process. In actual application, specific configuration can be made according to the situation and is not specifically limited here.

[0027] It should be noted that when the model training method and data processing method provided in the embodiment of the present application are executed separately by the server 200 or the electronic device 100, the above-mentioned application scenario may also only include any single device in the server 200 or the electronic device 100, or the server 200 and the electronic device 100 may also be considered to be the same device. In actual application, when the model training method and data processing method provided in the embodiment of the present application are jointly executed by the server 200 and the electronic device 100, the server 200 and the electronic device 100 may also be the same device, that is, the server 200 and the electronic device 100 may be different functional modules of the same device, or virtual devices virtualized from the same physical device.

[0028] In a possible implementation, the user may provide data through the electronic device 100, and the server 200 may use the data processing method of the embodiment of the present application to determine the prediction information of the data and return it to the electronic device 100 for presentation.

[0029] In the embodiment of the present application, the electronic device 100 and the server 200 can be directly or indirectly connected to each other through one or more networks. The network can be a wired network or a wireless network. For example, the wireless network can be a mobile cellular network or a Wireless Fidelity (Wi-Fi) network. Of course, it can also be other possible networks, and the embodiment of the present application does not limit this. It should be noted that Figure 1 The examples shown are just for illustration. In fact, the number of terminal devices and servers is not limited and is not specifically limited in the embodiments of this application.

[0030] The model training method and data processing method provided in the embodiments of the present application will be described below with reference to the accompanying drawings in combination with the application scenarios described above. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the embodiments of the present application, and the embodiments of the present application are not limited in this respect.

[0031] like Figure 2 FIG. 1 is a flow chart of a model training method provided by an embodiment of the present application. The model training method is applied to electronic devices, for example, Figure 1 The electronic device 100. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0032] S201 , feature encoding is performed on first sample data using a first model to obtain first encoding features of the first sample data.

[0033] In at least one embodiment of the present application, first sample data may be obtained to train the first model. For example, the first sample data may be obtained from a question-and-answer scenario. The first sample data may include, but is not limited to, text data, image data, audio data, and video data.

[0034] In at least one embodiment of the present application, the first model may be a model obtained by distilling a model with a larger number of parameters. The first model may include a coding layer, and the coding layer may include an embedding coding layer and a position coding layer. The electronic device encodes the first sample data through the embedding coding layer to obtain a first matrix, and encodes the first sample data through the position coding layer to obtain a second matrix. The electronic device adds the feature components in the first matrix and the feature components in the second matrix bit by bit to obtain a first coding feature, and the first coding feature can represent the first semantic feature obtained by the first model from parsing the first sample data. Taking the first sample data as text data as an example, if the first sample data includes word units, and the embedding dimension corresponding to each word unit is , we can get For example, if the first sample data is an image, the first sample data includes pixels, and the embedding dimension corresponding to each pixel is , we can get The first coding feature.

[0035] The embodiments of the present application utilize an embedded coding layer and a position coding layer to perform parallel analysis of the first sample data, thereby improving the efficiency of the first model's analysis of the first sample data. Furthermore, by combining the embedded coding layer and the position coding layer to determine the first coding feature, it is possible to ensure that the first coding feature includes both semantic information and position information of the first sample data.

[0036] S202: Based on a preset prompt word, determine a second coding feature of the first sample data through a second model.

[0037] In at least one embodiment of the present application, the number of parameters of the second model is greater than the number of parameters of the first model. For example, the second model can be a large language model. The second encoding feature can be obtained by the second model based on the first sample data. The second encoding feature can represent the second semantic feature obtained by the second model from parsing the first sample data. The second encoding feature can be expressed as , It can represent the length of the input information defined by the second model, for example, The maximum number of words or pixels that can represent the input information of the second model; The electronic device can determine the second coding feature of the first sample data by using the second model. Figure 3 As shown in the flow chart, Figure 3 The flowchart shown includes steps S301 to S310.

[0038] S301: Generate first prompt information according to a preset prompt word and first sample data.

[0039] In some embodiments, the electronic device concatenates the first sample data with the prompt word to obtain the first prompt information. The present application does not limit the concatenation order of the first sample data and the prompt word. The first prompt information can be used to instruct the second model to generate a reply message to the first sample data.

[0040] S302: Feature encoding is performed on the first prompt information through the second model to obtain encoding features of the first prompt information, and first reply information of the first sample data is generated based on the encoding features of the first prompt information.

[0041] In some embodiments, the electronic device inputs the first prompt information into the second model, performs feature encoding on the first prompt information through the first network layer in the second model, and obtains the encoding feature of the first prompt information. Based on the encoding feature of the first prompt information, the electronic device obtains the first reply information through the second network layer in the second model.

[0042] In this embodiment, the first network layer may include: a network layer from the encoding layer in the second model to the last hidden layer in the second model. The first network layer may also include: a network layer from the encoding layer in the second model to any hidden layer in the second model. This application does not impose specific limitations on this. The second network layer may include the output layer in the second model.

[0043] S303: Detect whether the first reply information meets a preset condition.

[0044] In some embodiments, the preset condition can be set and adjusted according to actual needs. For example, the preset condition can be set as follows: the similarity between the first reply message and the preset reply message of the first sample data is greater than a first similarity threshold, and the first similarity threshold can be set and adjusted according to actual needs. For another example, the preset condition can also be set as follows: the semantics of the first reply message and the preset reply message of the first sample data are the same. This application does not specifically limit the preset condition.

[0045] In some embodiments, if the first reply information meets the preset conditions, it may indicate that the sample complexity of the first sample data is low and the second model can fully understand the first sample data, then the electronic device executes step S304; if the first reply information does not meet the preset conditions, it may indicate that the sample complexity of the first sample data is high and the second model fails to understand the first sample data, then step S305 is executed.

[0046] S304: Determine the coding feature of the first prompt information as the second coding feature.

[0047] In some embodiments, when the second model fully understands the first sample data, the electronic device may determine the encoding feature of the first prompt information as the second encoding feature.

[0048] Combine Figure 4 Determine the second coding feature, such as Figure 4 As shown, the first prompt information Input is input into the large model (also referred to as the "second model" above). The first prompt information Input is encoded through the first network layer in the large model (also referred to as the "second model" above) to obtain the encoding feature of the first prompt information Input. The first reply information of the first sample data can be obtained through the second network layer in the large model (also referred to as the "second model" above). When the first reply information meets the preset conditions, the electronic device uses the encoding feature of the first prompt information by the first network layer in the large model (also referred to as the "second model" above) as the activated feature Output1 (also referred to as the "second encoding feature" above).

[0049] In an embodiment of the present application, when the first reply information corresponding to the first sample data generated by the second model meets the preset conditions, it can be indicated that the second model fully understands the first sample data. Therefore, the second coding feature can be accurately determined by the second model based on the coding feature of the first prompt information.

[0050] S305 , obtaining a sample whose similarity to the first sample data is greater than a preset similarity threshold as second sample data, and generating second prompt information according to the first prompt information, the second sample data, and preset reply information corresponding to the second sample data.

[0051] In some embodiments, when the second model fails to understand the first sample data, prompts may be added to the first sample data to help the second model understand the first sample data. For example, the prompts added to the first sample data may include: the N sample data in the dataset that are most similar to the first sample data and preset response information for the N sample data.

[0052] In some embodiments, the electronic device calculates the similarity between the first sample data and the sample data in the data set. The electronic device may select, from the data set, samples whose similarity is greater than a preset similarity threshold as the second sample data. The preset similarity threshold can be set and adjusted based on actual needs.

[0053] In other embodiments, the electronic device may select N samples with the highest similarity from the data set as the second sample data.

[0054] In other embodiments, the electronic device may further select N samples with the highest similarity from samples with similarity greater than a preset similarity threshold as the second sample data.

[0055] In some embodiments, the preset response information corresponding to the second sample data can also be obtained from the dataset. The electronic device concatenates the prompt word, the second sample data, the preset response information corresponding to the second sample data, and the first sample data to obtain the second prompt information. The second prompt information can be used to instruct the second model to generate a response information for the first sample data.

[0056] S306: Perform feature encoding on the second prompt information through the second model to obtain encoding features of the second prompt information, and generate second reply information of the first sample data based on the encoding features of the second prompt information.

[0057] In some embodiments, the electronic device inputs the second prompt information into the second model, performs feature encoding on the second prompt information through the first network layer in the second model, and obtains the encoding feature of the second prompt information. Based on the encoding feature of the second prompt information, the electronic device obtains the second reply information through the second network layer in the second model.

[0058] S307: Check whether the second reply information meets a preset condition.

[0059] In some embodiments, if the second reply information meets the preset conditions, it may mean that with the help of the second sample data and the preset reply information of the second sample data, the second model can understand the first sample data, and then step S308 is executed; if the second reply information does not meet the preset conditions, it may mean that with the help of the second sample data and the preset reply information of the second sample data, the second model still cannot understand the first sample data, and then step S309 is executed.

[0060] In other embodiments, if the second reply message does not meet the preset conditions, steps S305 and S306 may be repeated until the second reply message of the first sample data meets the preset conditions, or the number of executions of steps S305 and S306 reaches a preset number of times, where the preset number of times can be set and adjusted according to actual needs. In this embodiment, if the second reply message of the first sample data meets the preset conditions, step S308 is executed; if the number of executions of steps S305 and S306 reaches the preset number of times, step S309 is executed.

[0061] S308: Use the coding feature of the second prompt information as the second coding feature.

[0062] In this embodiment of the present application, when the first response does not meet the preset conditions, the second sample data and the preset response information for the second sample data are used to assist the second model in understanding the first sample data. When the second model generates a second response that meets the preset conditions for the second prompt, the encoding features of the second prompt from the second model can be used as the second encoding features, thereby improving the accuracy of the second encoding features.

[0063] S309: Generate third prompt information according to the second prompt information and the preset reply information of the first sample data.

[0064] In some embodiments, the electronic device concatenates the second prompt information and the preset reply information of the first sample data to obtain the third prompt information. This application does not limit the order in which the second prompt information and the preset reply information of the first sample data are concatenated. In other embodiments, the electronic device obtains the parsed information corresponding to the preset reply information of the first sample data, and concatenates the second prompt information, the preset reply information of the first sample data, and the parsed information corresponding to the preset reply information of the first sample data to obtain the third prompt information.

[0065] S310: Perform feature encoding on the third prompt information using the second model to obtain a second encoding feature.

[0066] Combine Figure 5 Determine the second coding feature, such as Figure 5 As shown, the first prompt information Input is input into the large model (also referred to as the "second model" above) to obtain the first reply information of the first sample data.

[0067] If the first response information does not meet the preset conditions, the electronic device obtains a sample whose similarity to the first sample data exceeds a preset similarity threshold as the second sample data, and adds the second sample data and the preset response information corresponding to the second sample data as the knowledge feedback correct solution to the first prompt information, thereby obtaining the second prompt information. The electronic device inputs the second prompt information into the large model (also referred to as the "second model" above) to obtain the second response information for the first sample data.

[0068] If the second response information does not meet the preset conditions, the electronic device repeatedly adds the second sample data and the preset response information corresponding to the second sample data as the correct solution to the knowledge feedback to the first prompt information, thereby obtaining the second prompt information. The electronic device inputs the second prompt information into the large model (also referred to as the "second model") to obtain the second response information for the first sample data.

[0069] When the second response information does not meet the preset conditions, the electronic device adds the preset response information of the first sample data as the correct solution to the knowledge feedback to the second prompt information, thereby obtaining third prompt information. The electronic device inputs the third prompt information into the large model (also referred to as the "second model") and uses the encoding feature of the third prompt information in the first network layer of the large model (also referred to as the "second model") as the activated feature Output 1 (also referred to as the "second encoded feature").

[0070] In an embodiment of the present application, when the second reply information does not meet the preset conditions, the preset reply information of the first sample data is further combined to assist the second model in understanding the first sample data, so that the encoding feature of the third prompt information by the second model can be used as the second encoding feature, thereby improving the accuracy of the second encoding feature.

[0071] S203: Perform multiple dimensionality reduction on the second coding feature according to the sample complexity of the first sample data to obtain a third coding feature.

[0072] In some embodiments, when the coding feature of the first prompt information is used as the second coding feature, the electronic device can use the first preset value as the sample complexity of the first sample data. The first preset value can be set and adjusted according to actual needs. In order to align the dimension of the model, the first preset value is usually set to an even number. For example, the first preset value can be set to 8.

[0073] In some embodiments, when the coding feature of the second prompt information is used as the second coding feature, the electronic device can use the second preset value as the sample complexity of the first sample data. The second preset value can be set and adjusted according to actual needs. The second preset value can be set and adjusted according to actual needs. The second preset value is smaller than the first preset value. The second preset value is usually set to an even number. For example, if the first preset value is 8, the second preset value can be set to 4.

[0074] In some embodiments, when the coding feature of the third prompt information is used as the second coding feature, the electronic device may use a third preset value as the sample complexity of the first sample data. The third preset value may be set and adjusted according to actual needs. The third preset value is less than the second preset value and is typically set to an even number. For example, if the first preset value is 8 and the second preset value is 4, the third preset value may be set to 2.

[0075] In at least one embodiment of the present application, the characteristic dimension of the second coding feature is greater than the characteristic dimension of the first coding feature. To facilitate the fusion of the first coding feature and the second coding feature, the electronic device needs to transform the second coding feature so that the characteristic dimension of the third coding feature obtained by the transformation is equal to the characteristic dimension of the first coding feature.

[0076] In at least one embodiment of the present application, the electronic device performs multiple dimensionality reduction on the second coding feature according to the sample complexity of the first sample data to obtain a third coding feature, including: dimensionality compression of the second coding feature according to the sample complexity to obtain a compressed second coding feature; and mapping the compressed second coding feature to obtain a third coding feature.

[0077] In some embodiments, the electronic device sets a compression layer corresponding to a first preset value, a compression layer corresponding to a second preset value, and a compression layer corresponding to a third preset value. The compression ratio corresponding to the compression layer can be set according to the corresponding sample complexity. Different compression layers correspond to different compression ratios. For example, if the first preset value is 8, the compression ratio of the compression layer corresponding to the first preset value can be set to 8; if the second preset value is 4, the compression ratio of the compression layer corresponding to the second preset value can be set to 4; if the third preset value is 2, the compression ratio of the compression layer corresponding to the third preset value can be set to 2.

[0078] In some embodiments, the electronic device selects a corresponding compression layer to perform dimension compression on the second coding feature according to the sample complexity of the first sample data to obtain the compressed second coding feature. For example, if the sample complexity of the first sample data is a first preset value, the first preset value is 8, and the feature dimension of the second coding feature is If the compression ratio of the compression layer corresponding to the first preset value is 8, the second coding feature (feature dimension 2) can be compressed by the compression layer with a compression ratio of 8. The feature dimension of the compressed second encoding feature is 256.

[0079] In some embodiments, the electronic device maps the compressed second coding feature through a linear layer to obtain a third coding feature. The third coding feature can be expressed as .

[0080] The embodiment of the present application can select a suitable compression layer for the second encoding feature to perform feature compression according to the sample complexity, thereby effectively retaining the features of the first sample data and reducing the loss of semantic features in the third encoding feature.

[0081] S204: Fusing the first coding feature and the third coding feature to obtain a fourth coding feature.

[0082] In at least one embodiment of the present application, in order to reduce information loss of the first sample data, the first coding feature and the third coding feature can be fused to make the features in the fourth coding feature more diversified, and the fourth coding feature carries the first semantic feature and the second semantic feature.

[0083] In at least one embodiment of the present application, the electronic device fuses the first coding feature and the third coding feature to obtain the fourth coding feature, including: determining the attention weight between the feature component in the first coding feature and the feature component in the third coding feature based on the first coding feature and the third coding feature; and performing weighted summation on the third coding feature based on the attention weight to obtain the fourth coding feature. The embodiment of the present application can effectively learn the correlation between the first coding feature and the third coding feature through the first coding feature and the third coding feature, so as to effectively extract the weight matrix of the second model for the first sample data. By performing weighted summation on the third coding feature through the attention weight, the feature components in the third coding feature can be integrated, thereby improving the globality and semantic richness of the fourth coding feature.

[0084] In some embodiments, the attention weight can be used to quantify the attention of the second model to the input of the first model. The calculation formula of the attention weight can be expressed as: ,in, It can represent the weight matrix, which includes OK The attention weights of the columns, can represent the first coding feature, can represent the third encoding feature, can represent the transpose of the third encoded feature, Used to achieve normalization.

[0085] In some embodiments, the calculation formula of the fourth coding feature can be expressed as: , ,in, Can represent the fourth coding feature, the fourth coding feature includes OK The characteristic components of the columns, It can be expressed as The attention weight of row j column, It can represent the feature component of the jth row and kth column in the third coding feature. In this embodiment, the global feature of the first sample data can be obtained by performing a weighted summation on the attention weight and the third coding feature.

[0086] S205 , based on the first coding feature and the fourth coding feature, predict the first sample data using the first model to obtain a prediction result.

[0087] In at least one embodiment of the present application, the first model includes a residual layer, an attention layer, and an output layer. The residual layer can be used to alleviate the problem of gradient disappearance or gradient explosion in the first model. The attention layer can be used to extract deep semantic features. The output layer can be set according to the configuration task. For example, the configuration task can include but is not limited to: text generation tasks (for example, machine translation, summary generation, dialogue generation, etc.), image generation tasks (for example, generating face images, generating landscape images, etc.), and classification tasks. For example, if the configuration task is a classification task, the output layer in the first model may include a fully connected layer and layer.

[0088] In at least one embodiment of the present application, the electronic device predicts the first sample data through the first model based on the first coding feature and the fourth coding feature to obtain a prediction result, including: performing bitwise operations on the feature components in the first coding feature and the feature components in the fourth coding feature through the residual layer to obtain a fifth coding feature; extracting the semantic features of the first sample data through the attention layer based on the fifth coding feature; and predicting the first sample data through the output layer based on the semantic features to obtain a prediction result. The embodiment of the present application can add the first coding feature corresponding to the first model and the fourth coding feature corresponding to the second model through the residual layer, which not only retains the knowledge of the second model but also enhances the information of the first coding feature, so that the first model can better learn the first model.

[0089] In some embodiments, the electronic device performs a bitwise addition operation on the feature components in the first coded feature and the feature components in the fourth coded feature through a residual layer to obtain a fifth coded feature. This embodiment, by fusing the first coded feature with the fourth coded feature, can preserve the complete data features in the first sample data, further reducing feature loss in the first sample data.

[0090] In some embodiments, the output layer can be used to predict the category of the first sample data, and the electronic device performs a linear transformation on the semantic features through the fully connected layer in the output layer to obtain the fifth encoding feature. The layer normalizes the fifth coded feature to obtain a probability vector, which includes multiple probability values. The electronic device determines the label corresponding to the largest probability value as the prediction result of the first sample data, and the prediction result is the category corresponding to the first sample data.

[0091] In some other embodiments, the output layer can also be used to generate an image corresponding to the first sample data, and the electronic device performs a linear transformation on the semantic features through the fully connected layer in the output layer to obtain the sixth encoding feature. The layer normalizes the sixth encoded feature to obtain a seventh encoded feature, scales the feature components in the seventh encoded feature, and converts the scaled feature components into integers to obtain pixel values. The electronic device renders the pixel values ​​as prediction results of the first sample data using an image processing library (e.g., Matplotlib or PIL), where the prediction result is an image corresponding to the first sample data.

[0092] In other embodiments, the output layer may also be used to output audio corresponding to the first sample data, etc., but actual applications are not limited thereto.

[0093] S206: Train a first model based on the label information and prediction results of the first sample data.

[0094] In at least one embodiment of the present application, the electronic device calculates a loss value of the first model based on the label information and prediction result of the first sample data. In one example, the electronic device may calculate the difference between the prediction result and the label information using cross-entropy loss to obtain the loss value. In another example, the electronic device may also calculate the difference between the prediction result and the label information using mean square error loss to obtain the loss value. Practical applications are not limited to this.

[0095] In at least one embodiment of the present application, the electronic device adjusts the first model based on the loss value until the loss value reaches a first preset condition. The first preset condition may include, but is not limited to: the loss value no longer decreases, the loss value is less than or equal to a preset loss threshold, and the preset loss threshold can be set and adjusted as needed.

[0096] In another embodiment, the electronic device may further adjust the first model based on the loss value until the number of adjustments or the learning rate reaches a second preset condition, wherein the second preset condition may include but is not limited to: the number of adjustments reaching a preset number of times or the learning rate reaching a preset value.

[0097] In the model training method of this embodiment, the second coding feature of the first sample data is determined by the second model. Since the number of parameters of the second model is greater than the number of parameters of the first model, the second coding feature obtained by the second model can more accurately characterize the first sample data. The second coding feature is reduced in dimension multiple times according to the sample complexity of the first sample data. Since the second coding feature is not reduced in dimension once, the loss of features in the first sample data can be reduced, and the second semantic feature can be effectively retained, thereby improving the training accuracy of the first model. By fusing the first coding feature and the third coding feature of the first sample data, since the fourth coding feature carries the first semantic feature and the second semantic feature, the prediction result of the first sample data is determined based on the fourth coding feature, so that the first model can better learn the features in the first sample data, thereby improving the convergence speed of the first model and improving the training efficiency of the first model. In addition, in the embodiment of the present application, the first model does not need to balance the loss relationship between the first model and the second model during the training process, and therefore, the training effect of the first model can be further improved.

[0098] like Figure 6 The figure shows a schematic diagram of the training framework of the first model provided in the embodiment of the present application. Figure 6 In the example, the electronic device takes the first sample data (taking the first sample data as text for example, the sentence length of the first sample data is ) is input into the encoding layer of the first model for feature encoding, and the obtained Feature 1 (also referred to as the “first coding feature” above).

[0099] Electronic devices will Output1 (also referred to as the "second encoded feature" above) is feature mapped to obtain Feature 2 (also referred to as the “third coding feature” above). Taking the first sample data including 30 samples as an example, we can get Output1. The Output1 of includes 15 samples of Output1 with a first preset value complexity (for example, the first preset value is 8), 10 samples of Output1 with a second preset value complexity (for example, the second preset value is 4), and 5 samples of Output1 with a third preset value complexity (for example, the third preset value is 8), then we can get Output1, Output1 and Output1.

[0100] In the pair During the feature mapping process of Output1 (also referred to as the “second encoded feature” above), the electronic device can select the corresponding compression layer according to the sample complexity of Output1 and compress Output1. Figure 6 As shown, the electronic device is connected to the Output1 is compressed to obtain the compressed second encoding feature , through the compression layer Linear4 Output1 is compressed to obtain the compressed second encoding feature , through the compression layer Linear2 Output1 is compressed to obtain the compressed second encoding feature The electronic device uses the linear layer to compress the second encoded feature. Mapping is performed by using the linear layer Linear to compress the second encoded features Mapping is performed by using the linear layer Linear to compress the second encoded features Mapping, we get Feature 2 (also referred to as the "third coding feature" above).

[0101] Electronic devices calculate through the Attention mechanism Feature 1 (also referred to as the “first coding feature” above) and The attention weight of feature 2 (also referred to as the “third encoding feature” above) is obtained The electronic device is based on The weight matrix of The feature 2 (also referred to as the “third coding feature” above) is fused to obtain The fourth coding feature.

[0102] Electronic devices use the residual layer Add to Feature 1 (also referred to as the “first coding feature” above) and The electronic device performs a bitwise operation on the fourth encoded feature to obtain a fifth encoded feature. The electronic device inputs the fifth encoded feature into the attention layer for feature extraction to obtain a semantic feature. The electronic device inputs the semantic feature into the output layer for prediction to obtain a prediction result.

[0103] like Figure 7FIG. 1 is a flow chart of a data processing method provided by an embodiment of the present application. The data processing method is applied to electronic devices, for example, Figure 1 The electronic device 100. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0104] S701: predict the data using a prediction model to obtain prediction information of the data.

[0105] In at least one embodiment of the present application, the data may include information in a variety of application scenarios. For example, the data may include but is not limited to text, images, audio, etc.

[0106] In at least one embodiment of the present application, the prediction model can be Figure 2 The first model obtained by training the process shown. Figure 8 Describe the network framework of the prediction model. Figure 8 As shown in FIG, the prediction model may include a coding layer, a residual layer Add, an attention layer, and an output layer Output. Practical applications are not limited thereto.

[0107] In at least one embodiment of the present application, in the process of predicting data through a prediction model, the electronic device inputs the data into the coding layer in the prediction model for feature encoding to obtain a first eigenvector. The electronic device inputs the first eigenvector into the residual layer Add in the prediction model. The residual layer Add may include an all-zero matrix. The electronic device may perform a bitwise operation on the feature components in the first eigenvector and the feature components in the all-zero matrix of the residual layer Add to obtain a second eigenvector. The electronic device extracts features from the second eigenvector through the attention layer in the prediction model to obtain a third eigenvector, and maps the third eigenvector through the output layer in the prediction model to obtain prediction information.

[0108] In at least one embodiment of the present application, the prediction information may include, but is not limited to: text categories, image categories, audio categories, text generated based on data (e.g., abstracts, translations, etc.), and images generated based on data (e.g., landscape images, etc.).

[0109] In the data processing method of this embodiment, since the prediction model's network framework is smaller than that of the large model, the efficiency of obtaining prediction information can be improved when predicting data using the prediction model. Furthermore, since the prediction model integrates the features of the large model during training, the performance of the prediction model can be further improved, thereby increasing the accuracy of the prediction information.

[0110] like Figure 9, is a functional module diagram of a model training device provided by an embodiment of the present application. The model training device 91 includes an encoding unit 910, a determination unit 911, a dimensionality reduction unit 912, a fusion unit 913, a prediction unit 914, a training unit 915, and a generation unit 916. The module / unit referred to in this application refers to a unit that can be processed by a processor (e.g. Figure 11 The processor 1101 shown in FIG. 1 is obtained and is capable of performing a series of computer-readable instruction segments that are stored in a memory (eg, Figure 11 1102).

[0111] In one embodiment, an encoding unit 910 is used to perform feature encoding on first sample data through a first model to obtain a first encoding feature of the first sample data, where the first encoding feature represents a first semantic feature obtained by parsing the first sample data by the first model; a determination unit 911 is used to determine a second encoding feature of the first sample data through a second model based on a preset prompt word, where the parameter amount of the second model is greater than the parameter amount of the first model, and the second encoding feature represents a second semantic feature obtained by parsing the first sample data by the second model; a dimensionality reduction unit 912 is used to perform multiple dimensionality reductions on the second encoding feature according to the sample complexity of the first sample data to obtain a third encoding feature; a fusion unit 913 is used to fuse the first encoding feature and the third encoding feature to obtain a fourth encoding feature, where the fourth encoding feature carries the first semantic feature and the second semantic feature; a prediction unit 914 is used to predict the first sample data through the first model based on the first encoding feature and the fourth encoding feature to obtain a prediction result; and a training unit 915 is used to train the first model based on the label information and the prediction result of the first sample data.

[0112] In one embodiment, the determination unit 911 is specifically used to: generate a first prompt message based on a preset prompt word and first sample data; perform feature encoding on the first prompt message through a second model to obtain the encoding feature of the first prompt message, and generate a first reply message of the first sample data based on the encoding feature of the first prompt message; if the first reply message meets the preset conditions, determine the encoding feature of the first prompt message as the second encoding feature, and use the first preset value as the sample complexity.

[0113] In one embodiment, the generation unit 916 is used to obtain a sample whose similarity with the first sample data is greater than a preset similarity threshold as the second sample data if the first reply information does not meet the preset conditions, and generate the second prompt information according to the first prompt information, the second sample data and the preset reply information corresponding to the second sample data; the generation unit 916 is also used to feature encode the second prompt information through the second model to obtain the encoding feature of the second prompt information, and generate the second reply information of the first sample data based on the encoding feature of the second prompt information; the determination unit 911 is also used to use the encoding feature of the second prompt information as the second encoding feature and the second preset value as the sample complexity if the second reply information meets the preset conditions, and the second preset value is less than the first preset value.

[0114] In one embodiment, the generation unit 916 is also used to generate a third prompt message based on the second prompt message and the preset reply information of the first sample data if the second reply message does not meet the preset conditions; the determination unit 911 is also used to perform feature encoding on the third prompt message through the second model to obtain a second encoding feature, and use a third preset value as the sample complexity, and the third preset value is less than the second preset value.

[0115] In one embodiment, the dimensionality reduction unit 912 is specifically used to: compress the dimension of the second coding feature according to the sample complexity to obtain a compressed second coding feature; map the compressed second coding feature to obtain a third coding feature, and the feature dimension of the third coding feature is equal to the feature dimension of the first coding feature.

[0116] In one embodiment, the fusion unit 913 is specifically used to: determine the attention weight between the feature component in the first coding feature and the feature component in the third coding feature based on the first coding feature and the third coding feature; and perform weighted summation on the third coding feature based on the attention weight to obtain the fourth coding feature.

[0117] In one embodiment, the first model includes a residual layer, an attention layer and an output layer, and the prediction unit 914 is specifically used to: perform bitwise operations on the feature components in the first coding feature and the feature components in the fourth coding feature through the residual layer to obtain a fifth coding feature; based on the fifth coding feature, extract the semantic features of the first sample data through the attention layer; and predict the first sample data through the output layer according to the semantic features to obtain a prediction result.

[0118] In multiple embodiments of the present application, the second coding feature of the first sample data is determined by the second model. Since the number of parameters of the second model is greater than the number of parameters of the first model, the second coding feature obtained by the second model can more accurately characterize the first sample data. The second coding feature is reduced in dimension multiple times according to the sample complexity of the first sample data. Since the second coding feature is not reduced in dimension once, the loss of features in the first sample data can be reduced, and the second semantic feature can be effectively retained, thereby improving the training accuracy of the first model. By fusing the first coding feature and the third coding feature of the first sample data, since the fourth coding feature carries the first semantic feature and the second semantic feature, the prediction result of the first sample data is determined based on the fourth coding feature, so that the first model can better learn the features in the first sample data, thereby improving the convergence speed of the first model and improving the training efficiency of the first model. In addition, in an embodiment of the present application, the first model does not need to balance the loss relationship between the first model and the second model during training, and therefore, the training effect of the first model can be further improved.

[0119] like Figure 10 , which is a functional module diagram of a data processing device provided by an embodiment of the present application. The data processing device 1001 includes a prediction module 1010. The module / unit referred to in this application refers to a module that can be processed by a processor (e.g. Figure 11 The processor 1101 shown in FIG. 1 is obtained and is capable of performing a series of computer-readable instruction segments that are stored in a memory (eg, Figure 11 1102).

[0120] In one embodiment, the prediction module 1010 is used for identifying a module, and is used for predicting data through a prediction model to obtain prediction information of the data.

[0121] In various embodiments of the present application, because the prediction model's network framework is smaller than that of the large model, the efficiency of obtaining prediction information can be improved when predicting data using the prediction model. Furthermore, because the prediction model integrates the features of the large model during training, the performance of the prediction model can be further improved, thereby improving the accuracy of the prediction information.

[0122] Figure 11 Schematic diagram of the structure of an electronic device for implementing the model training method and data processing method provided in the embodiment of the present application. Figure 11 The electronic device 100 is used to perform Figure 2 、 Figure 3 and Figure 7 The method shown.

[0123] The electronic device 100 includes at least one processor 1101 , a memory 1102 , and at least one network interface 1103 .

[0124] The processor 1101 is, for example, a general-purpose central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the solution of the present application. For example, the processor 1101 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0125] The memory 1102 may be, for example, a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, a random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Optionally, the memory 1102 exists independently and is connected to the processor 1101 via the internal connection 1104. Alternatively, the memory 1102 and the processor 1101 may be integrated together.

[0126] The network interface 1103 uses any transceiver-like device for communicating with other devices or communication networks. For example, the network interface 1103 includes at least one of a wired network interface and a wireless network interface. For example, the wired network interface is an Ethernet interface. For example, the Ethernet interface is an optical interface, an electrical interface, or a combination thereof. For example, the wireless network interface is a wireless local area network (WLAN) interface, a cellular network interface, or a combination thereof.

[0127] In some embodiments, the processor 1101 includes one or more CPUs, such as Figure 8 CPU0 and CPU1 are shown in the figure.

[0128] In some embodiments, the electronic device 100 optionally includes multiple processors, such as Figure 8 1 and 1105. Each of these processors is, for example, a single-CPU or a multi-CPU. A processor herein optionally refers to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0129] In some embodiments, electronic device 100 further includes internal connections 1104. Processor 1101, memory 1102, and at least one network interface 1103 are connected via internal connections 1104. Internal connections 1104 include pathways for transmitting information between these components. Internal connections 1104 may optionally be a single board or bus. Internal connections 1104 may optionally be divided into an address bus, a data bus, a control bus, and the like.

[0130] In some embodiments, the electronic device 100 further includes an input / output interface 1106 , which is connected to the internal connection 1104 .

[0131] Optionally, the processor 1101 implements the method in the above embodiment by reading the program code 910 stored in the memory 1102, or the processor 1101 implements the method in the above embodiment by internally stored program code. In the case where the processor 1101 implements the method in the above embodiment by reading the program code 910 stored in the memory 1102, the memory 1102 stores the program code that implements the method provided in the embodiment of the present application.

[0132] For more details on how the processor 1101 implements the above functions, please refer to the descriptions in the previous method embodiments, which will not be repeated here.

[0133] This embodiment also provides a computer storage medium, which stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the model training method and data processing method in the above-mentioned embodiment.

[0134] This embodiment also provides a computer program product. When the computer program product runs on an electronic device, it enables the electronic device to execute the above-mentioned related steps to implement the model training method and data processing method in the above-mentioned embodiment.

[0135] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory to enable the chip to execute the model training method and data processing method in the above-mentioned method embodiments.

[0136] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.

[0137] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0138] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0139] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0140] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0141] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.

[0142] The above are only specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A model training method, characterized in that: The method comprises: Performing feature encoding on the first sample data using a first model to obtain a first encoding feature of the first sample data, where the first encoding feature represents a first semantic feature obtained by parsing the first sample data by the first model; Based on a preset prompt word, determining a second encoding feature of the first sample data using a second model, wherein a parameter quantity of the second model is greater than a parameter quantity of the first model, and the second encoding feature represents a second semantic feature obtained by parsing the first sample data by the second model; Performing multiple dimensionality reduction on the second coding feature according to the sample complexity of the first sample data to obtain a third coding feature; fusing the first coding feature and the third coding feature to obtain a fourth coding feature, where the fourth coding feature carries the first semantic feature and the second semantic feature; Based on the first coding feature and the fourth coding feature, predicting the first sample data using the first model to obtain a prediction result; The first model is trained based on the label information of the first sample data and the prediction result.

2. The model training method according to claim 1, characterized in that The determining, based on the preset prompt word, the second coding feature of the first sample data by using the second model includes: Generate first prompt information according to the preset prompt word and the first sample data; Performing feature encoding on the first prompt information using the second model to obtain encoding features of the first prompt information, and generating first reply information of the first sample data based on the encoding features of the first prompt information; If the first reply information meets a preset condition, the encoding feature of the first prompt information is determined as the second encoding feature, and a first preset value is used as the sample complexity.

3. The model training method according to claim 2, characterized in that The method further comprises: If the first reply information does not meet the preset condition, obtaining a sample whose similarity to the first sample data is greater than a preset similarity threshold as the second sample data, and generating a second prompt information according to the first prompt information, the second sample data, and the preset reply information corresponding to the second sample data; Performing feature encoding on the second prompt information using the second model to obtain encoding features of the second prompt information, and generating second reply information of the first sample data based on the encoding features of the second prompt information; If the second reply information meets the preset condition, the encoding feature of the second prompt information is used as the second encoding feature, and a second preset value is used as the sample complexity, and the second preset value is smaller than the first preset value.

4. The model training method according to claim 3, characterized in that The method further comprises: If the second reply information does not meet the preset condition, generating a third prompt information according to the second prompt information and the preset reply information of the first sample data; The third prompt information is feature-encoded using the second model to obtain the second encoding feature, and a third preset value is used as the sample complexity, where the third preset value is less than the second preset value.

5. The model training method according to claim 1, characterized in that The step of performing multiple dimensionality reduction on the second coding feature according to the sample complexity of the first sample data to obtain a third coding feature includes: Performing dimension compression on the second coding feature according to the sample complexity to obtain a compressed second coding feature; Mapping is performed on the compressed second coding feature to obtain the third coding feature, where a feature dimension of the third coding feature is equal to a feature dimension of the first coding feature.

6. The model training method according to claim 1, characterized in that The fusing of the first coding feature and the third coding feature to obtain a fourth coding feature includes: Determining, based on the first coding feature and the third coding feature, an attention weight between a feature component in the first coding feature and a feature component in the third coding feature; Based on the attention weight, the third coding feature is weighted summed to obtain the fourth coding feature.

7. The model training method according to claim 1, characterized in that The first model includes a residual layer, an attention layer, and an output layer. The first sample data is predicted by the first model based on the first coding feature and the fourth coding feature to obtain a prediction result, including: performing a bitwise operation on a feature component in the first coding feature and a feature component in the fourth coding feature through the residual layer to obtain a fifth coding feature; Extracting semantic features of the first sample data through the attention layer based on the fifth encoding feature; According to the semantic features, the first sample data is predicted through the output layer to obtain the prediction result.

8. A data processing method, characterized in that: The method comprises: The data is predicted by a prediction model to obtain prediction information of the data, wherein the prediction model is obtained by the model training method according to any one of claims 1 to 7.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the model training method according to any one of claims 1 to 7 or the data processing method according to claim 8 is implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the model training method according to any one of claims 1 to 7 or the data processing method according to claim 8.

11. A computer program product, characterized in that The computer program product includes a computer program, which, when executed by a processor, implements the model training method according to any one of claims 1 to 7 or the data processing method according to claim 8.

Citation Information

Patent Citations

  • Training data set construction method and device, equipment, storage medium and program product

    CN117669774A

  • Model training method and device, question and answer processing method and device and electronic equipment

    CN118797022A

  • Method for constructing defect detection model, method for detecting defect and related apparatus

    US12254612B1

  • Student model generation method and apparatus based on large model

    WO2025081878A1