Model training method and related apparatus

By training a semantic adapter to replace the large language model for reasoning, the problem of time-consuming generation of user preference knowledge by the large language model is solved, and the requirements of efficient data representation and timeliness of recommendation system are realized.

WO2026061060A1PCT designated stage Publication Date: 2026-03-26HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-06-28
Publication Date
2026-03-26

AI Technical Summary

Technical Problem

Large language models take a long time to generate user preference knowledge, making it difficult to meet the timeliness requirements of recommendation systems.

Method used

By training a semantic adapter, the large language model is used as a decoder. Generative artificial intelligence models are used to train the semantic adapter to enhance data representation. The trained semantic adapter is then deployed independently to replace the large language model for reasoning.

Benefits of technology

It improves the performance of the recommendation system, meets the timeliness requirements of the recommendation system, reduces the dependence on large language models, and improves the efficiency of data representation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025105159_26032026_PF_FP_ABST
    Figure CN2025105159_26032026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a model training method and a related apparatus, which are used for training a semantic adapter on the basis of a large language model as a decoder, wherein the trained semantic adapter can be used for enhancing data representations. The method comprises: performing feature extraction on first modality data to obtain a first modality feature vector; analyzing the first modality feature vector and a query vector by means of a semantic adapter, so as to obtain a first information aggregation embedding vector, wherein the semantic adapter is used for performing knowledge enhancement on the first modality feature vector; and on the basis of a generation result obtained by a generative artificial intelligence model on the basis of the first information aggregation embedding vector, training the semantic adapter, so as to obtain a trained semantic adapter, wherein the trained semantic adapter is used for obtaining a second information aggregation embedding vector on the basis of a second modality feature vector, and the second modality feature vector is obtained by performing feature extraction on second modality data.
Need to check novelty before this filing date? Find Prior Art

Description

A model training method and related apparatus

[0001] The present application claims priority to the Chinese patent application No. 202411322777.X, filed on September 20, 2024, and entitled "A model training method and related apparatus", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD

[0002] The present application relates to the field of artificial intelligence, and in particular to a model training method and related apparatus. BACKGROUND

[0003] At present, recommendation systems have been widely applied in online advertising, e-commerce, and short video streaming media scenarios. Traditional recommendation models follow the Collaborative Filtering (CF) method to analyze and utilize historical interaction data of users and items. Among them, Collaborative Filtering is a widely used recommendation algorithm that recommends items to users based on their historical behavior data and the similarity of other users or items. However, with the widespread adoption of neural networks in recommendation models, the methodology has changed significantly, making it possible to model complex interactions of fine-grained co-occurrence features. With the powerful reasoning capabilities of Large Language Models (LLM) achieving great success in the natural language field, many techniques have emerged that apply LLM to recommendation systems.

[0004] LLM brings powerful semantic understanding, knowledge transfer, and content generation capabilities to recommendation systems. Techniques that apply LLM to recommendation systems mainly include replacing existing recommendation algorithms with LLM and using LLM to assist in improving recommendation capabilities. Among them, replacing recommendation algorithms with LLM is mainly aimed at interactive recommendation scenarios, which can convert user profiles and historical interaction data into prompt words to input into LLM and estimate user interests through LLM's context learning technology.

[0005] However, the process of generating user preference knowledge by a large language model is time-consuming, making it difficult to meet the timeliness requirements of providing recommended items to users in real-world scenarios. SUMMARY

[0006] The present application provides a model training method and related apparatus for training a semantic adapter based on a large language model as a decoder. The trained semantic adapter can be used to enhance data representation.

[0007] In a first aspect, the present application provides a model training method, comprising: performing feature extraction on first modality data to obtain a first modality feature vector, wherein the first modality data can be text data, image data, or video data, or data of different modalities. After obtaining the first modality feature vector, the first modality feature vector and a query vector can be analyzed by a semantic adapter to obtain a first information aggregation embedding vector, the semantic adapter is used to enhance the knowledge of the first modality feature vector, the query vector is used to extract the key features of the first modality data, and the first information aggregation embedding vector is obtained by learning the query vector based on the first modality feature vector. Subsequently, the semantic adapter is trained based on the generation result of the generative artificial intelligence model based on the first information aggregation embedding vector, to obtain a trained semantic adapter, and the trained semantic adapter can be used to obtain a second information aggregation embedding vector based on a second modality feature vector, wherein the second modality feature vector is obtained by performing feature extraction on second modality data.

[0008] In the embodiments of the present application, the generative artificial intelligence model can be used as a decoder, and the data representation extracted by the semantic adapter can be used for sample reconstruction training. The data representation is decoded to obtain text data or image data, and then the semantic adapter can be trained based on the text data or image data. The trained semantic adapter can be directly used to enhance the extracted modality data representation, and does not depend on a large language model. The efficiency of enhancing the extracted representation can be improved when enhancing the extracted modality data representation.

[0009] In a possible implementation, the method further comprises: performing inference on the second modality feature vector by the trained semantic adapter to obtain a second information aggregation embedding vector, and the second information aggregation embedding vector is used to indicate that a recommendation model performs inference based on the second information aggregation embedding vector to obtain a recommendation result.

[0010] In the embodiments of the present application, the trained semantic adapter can be independently deployed to further extract the representation of the modality data, to enhance the extracted modality data representation, and the extracted representation can be used as the input of the recommendation system to improve the performance of the recommendation system, without relying on a large language model to improve the performance of the recommendation system. Using the trained semantic adapter to enhance the data representation can ensure that the effect of enhancing the data representation meets the timeliness requirements of the recommendation system.

[0011] In a possible implementation, the first modal data described above includes text data or image data, and the training of the semantic adapter based on the generated result of the generative artificial intelligence model according to the first information aggregation embedding vector can include: performing inference on the first information aggregation embedding vector by using a large language model to obtain first text data; and training the semantic adapter according to second text data corresponding to the first information aggregation embedding vector and the first text data, to obtain the trained semantic adapter, the second text data being text data or image data.

[0012] In the embodiments of the present application, the large language model can be used as a decoder to decode the information aggregation embedding vector obtained through the semantic adapter, and the semantic adapter can be trained according to the decoded text data and the original text data, or the decoded text data and the text description of the original image, to improve the effect of the subsequent semantic adapter in extracting data representation.

[0013] In a possible implementation, the inference on the first information aggregation embedding vector by using the large language model to obtain the first text data can include: performing linear projection on the first information aggregation embedding vector according to the word vector dimension of the large language model to obtain third information aggregation embedding vector; and performing inference on the third information aggregation embedding vector by using the large language model to obtain the first text data.

[0014] In a possible implementation, the training of the semantic adapter according to the second text data corresponding to the first information aggregation embedding vector and the first text data to obtain the trained semantic adapter can include: adjusting the parameters of the semantic adapter according to the difference between the first text data and the second text data, until the difference between the first text data and the second text data is less than a preset value, and stopping adjusting the parameters to obtain the trained semantic adapter.

[0015] In the embodiments of the present application, the semantic adapter can be trained according to the difference between the first text data and the original text data to enhance the data representation extracted by the semantic adapter.

[0016] In a possible implementation, the semantic adapter is an encoder obtained by combining components based on a transformer structure.

[0017] In a second aspect, the present application provides a model training device, comprising: an extraction module configured to perform feature extraction on first modality data to obtain a first modality feature vector; an analysis module configured to analyze the first modality feature vector and a query vector by a semantic adapter to obtain a first information aggregation embedding vector, the semantic adapter being configured to perform knowledge enhancement on the first modality feature vector, the query vector being configured to extract key features of the first modality data, and the first information aggregation embedding vector being obtained by learning of the query vector based on the first modality feature vector; and a training module configured to train the semantic adapter based on a generation result of a generative artificial intelligence model based on the first information aggregation embedding vector to obtain a trained semantic adapter, the trained semantic adapter being configured to obtain a second information aggregation embedding vector based on a second modality feature vector, the second modality feature vector being obtained by performing feature extraction on second modality data.

[0018] In a possible implementation, the device can further comprise an inference module configured to perform inference on the second modality feature vector by the trained semantic adapter to obtain the second information aggregation embedding vector, the second information aggregation embedding vector being configured to indicate a recommendation result obtained by a recommendation model based on the second information aggregation embedding vector.

[0019] In a possible implementation, the first modality data described above comprises text data or image data, and the training module described above is specifically configured to: perform inference on the first information aggregation embedding vector by a large language model to obtain first text data; and train the semantic adapter based on the first text data and second text data corresponding to the first information aggregation embedding vector to obtain the trained semantic adapter, the second text data being a text description of the text data or the image data.

[0020] In a possible implementation, the training module described above is specifically configured to: perform linear projection on the first information aggregation embedding vector based on a word vector dimension of the large language model to obtain a third information aggregation embedding vector; and perform inference on the third information aggregation embedding vector by the large language model to obtain the first text data.

[0021] In a possible implementation, the training module described above is specifically configured to: adjust parameters of the semantic adapter based on a difference between the first text data and the second text data until the difference between the first text data and the second text data is less than a preset value, stop adjusting the parameters, and obtain the trained semantic adapter.

[0022] In a possible implementation, the semantic adapter described above is an encoder obtained by combining components based on a transformer structure.

[0023] In a third aspect, the present application provides a model training apparatus, comprising a processor, a memory, an input and output device, and a bus; the memory stores computer instructions; when the processor executes the computer instructions in the memory, the memory stores computer instructions; and the processor, when executing the computer instructions in the memory, is configured to implement the method of the first aspect or any possible implementation manner of the first aspect.

[0024] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium. The computer readable storage medium stores computer instructions; when the computer instructions run on a computer, the computer executes the method of the first aspect or any possible implementation manner of the first aspect.

[0025] In a fifth aspect, the embodiments of the present application provide a computer program product. The computer program product comprises computer programs or instructions; when the computer programs or instructions run on a computer, the computer executes the method of the first aspect or any possible implementation manner of the first aspect.

[0026] The technical effects brought by the second aspect to the fifth aspect or any possible implementation manner thereof can refer to the technical effects brought by the first aspect or the related possible implementation manner of the first aspect, which will not be described here. BRIEF DESCRIPTION OF DRAWINGS

[0027] FIG. 1 is a schematic diagram of a system architecture provided by the present application;

[0028] FIG. 2 is a training flow of training a semantic adapter by taking a large language model as a decoder and an inference process of inferring a modal feature vector based on the semantic adapter;

[0029] FIG. 3 is a schematic diagram of a model training method provided by the present application;

[0030] FIG. 4 is a schematic diagram of a model training apparatus provided by the present application. DETAILED DESCRIPTION

[0031] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of the present application.

[0032] The method provided in the application can be applied in an artificial intelligence (AI) scene. AI is a theory, method, technology and application system for simulating, extending and expanding human intelligence by using a digital computer or a machine controlled by a digital computer to perceive an environment, acquire knowledge and use the knowledge to obtain optimal results. In other words, AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. AI is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making. The research in the field of AI includes robots, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, AI basic theory, etc.

[0033] First, the overall workflow of the artificial intelligence system is described, and then the above-mentioned artificial intelligence theme framework is described from two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, data undergoes a condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value brought by artificial intelligence to the information technology industry from the bottom infrastructure of human intelligence, information (provision and processing technology implementation) to the industrial ecological process of the system.

[0034] (1) Infrastructure

[0035] The infrastructure provides computing power support for the artificial intelligence system, realizes communication with the outside world, and realizes support through the underlying platform. Communication with the outside world through sensors; computing power is provided by intelligent chips (CPU, NPU, GPU, ASIC, FPGA, etc. Hardware acceleration chips); the underlying platform includes distributed computing framework and network related platform guarantee and support, which can include cloud storage and computing, interconnection network, etc. For example, sensors and external communication acquire data, which are provided to intelligent chips in the distributed computing system provided by the underlying platform for calculation.

[0036] (2) Data

[0037] The data on the upper layer of the infrastructure is used to represent the data source in the field of artificial intelligence. Data involves graphics, images, speech, text, and also involves Internet of Things data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature and humidity.

[0038] (3) Data processing

[0039] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, and the like.

[0040] Among them, machine learning and deep learning can model, extract, preprocess, train, and the like of symbolic and formalized intelligent information on data.

[0041] Reasoning refers to the process of simulating human intelligent reasoning methods in a computer or intelligent system, using formalized information to perform machine thinking and solve problems according to reasoning control strategies, and the typical function is search and matching.

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

[0043] (4) General capabilities

[0044] After data is processed as mentioned above, some general capabilities can be formed based on the results of data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, and the like.

[0045] (5) Intelligent products and industry applications

[0046] Intelligent products and industry applications refer to products and applications of artificial intelligence systems in various fields, which are encapsulations of overall solutions of artificial intelligence, and realize the productization and landing application of intelligent information decision-making. The application fields mainly include intelligent terminals, intelligent transportation, intelligent medical treatment, automatic driving, smart cities, and the like.

[0047] In order to better understand the scheme of the embodiments of the present application, first, the related terms and concepts that may be involved in the embodiments of the present application are introduced.

[0048] (1) Large language model (Large Language Model, LLM)

[0049] LLM refers to a language model containing hundreds of millions (or more) of parameters, which are trained on a large amount of text data, and is a natural language processing model based on deep learning. These models can process a large amount of text data, thereby learning the grammar and semantic rules of natural language. LLM can be applied to text generation, machine translation, question and answer systems, text summarization, or sentiment analysis, etc., and has the advantages of strong generation ability, strong adaptability, accurate prediction, and strong scalability. For example, in the movie recommendation scenario, a large language model can generate a description of the movie scene, including movie type, lead actor, plot, etc., so that the system can better recommend similar movies. A large language model can also generate a recommendation reason, such as an e-commerce website can generate a reason for recommending a product through a large language model, such as the quality, price, and functionality of the product, so that users can better understand the value of the product.

[0050] (2) Recommendation System

[0051] A recommendation system is a network technology that uses data mining, natural language processing, and other domain knowledge to analyze user historical behavior, personal preferences, and interest data to recommend personalized products, services, and information to users. The recommendation system can help users quickly find content they like and are interested in, improve user satisfaction and loyalty, and also help businesses increase sales and user retention.

[0052] The recommendation system is widely used in e-commerce, social media, online video, news reading, and other fields. For example, on an e-commerce platform, the recommendation system can recommend products that may be of interest to users based on their purchase history and browsing behavior; on social media, the recommendation system can recommend friends or content that may be of interest to users; on an online video platform, the recommendation system can recommend videos that may be of interest to users, etc.

[0053] (3) Embedding

[0054] Embedding is an important representation method in the field of machine learning and deep learning, which is mainly used to convert discrete, high-dimensional, and sparse data (such as words, sentences, images, etc.) into continuous, low-dimensional, and dense vector representations. These vectors usually have a fixed dimension and can maintain the semantic relationship between objects in the vector space. This conversion allows machine learning models to more effectively process and understand these data, thereby improving the performance and accuracy of the model.

[0055] Embedding can capture the similarities and differences between objects, allowing machine learning models to perform various tasks based on these vectors, such as classification, clustering, recommendation, and prediction, etc.

[0056] (4) Self-Attention

[0057] Self-Attention is an attention mechanism in deep learning, particularly effective when dealing with sequential data such as text in natural language processing. It works by calculating the similarity between each element in a sequence and other elements, generating attention weights. These attention weights are then used to weight the sum of elements in the sequence, resulting in a new representation of each element that includes information from other elements in the sequence.

[0058] (5) Multi-head Self-Attention

[0059] Multi-head Self-Attention is a core component of the Transformer model in deep learning, particularly in natural language processing (NLP). It builds on the Self-Attention mechanism by running multiple independent Self-Attention mechanisms in parallel to enhance the model's ability to express and capture complex dependencies.

[0060] (6) Multi-head Cross-Attention

[0061] Multi-head Cross-Attention is an advanced application of attention mechanisms in deep learning that combines the strengths of Multi-Head Attention and Cross-Attention to handle more complex data relationships.

[0062] Multi-head Cross-Attention involves using multiple cross-attention heads in parallel to capture complex interactions between two different input sequences when processing them. Each cross-attention head independently calculates the similarity between the two sequences and generates attention weights based on these similarities, which are then used to weight the sum of each sequence's representation.

[0063] (7) Lay Normalization

[0064] Lay Normalization is a normalization method applied in neural networks that normalizes the input of each hidden layer for each sample. Specifically, it standardizes the activation of each neuron so that it has a mean of 0 and a variance of 1. This process helps keep the activations of each neuron on a relatively similar scale, improving the stability of training.

[0065] With the development of large language models, the technology of applying LLM to the recommendation system also emerges. For example, a large language model can be used to replace the recommendation algorithm, and user portraits and historical interaction data are converted into prompt words as input of the large language model, and the user interest is predicted by the large language model to recommend items, services or goods to the user. However, the large language model takes a long time to generate user preference knowledge, which cannot meet the timeliness requirement of providing recommendations to users in real recommendation scenarios. In addition, the original data in the real business environment is usually changed through encoding, encryption and the like, so that the LLM enhanced recommendation scheme of converting user portraits and historical interaction data into prompt words as input is no longer applicable.

[0066] To solve the current problems, the embodiments of the present application propose a model training method, which can use a large language model as a decoder, decode information aggregation embedding vectors obtained through a semantic adapter to obtain text data, and train the semantic adapter by comparing the differences between the text data and the initial text to enhance the representation of the information aggregation embedding vectors obtained by the semantic adapter. Moreover, the trained semantic adapter can be deployed separately to infer according to the input modal feature vectors to obtain information aggregation embedding vectors, which can be directly used as input of the recommendation system, thereby avoiding deploying a large language model, using the semantic adapter to replace the large language model for inference, and further ensuring to improve the performance of the recommendation model while avoiding high latency.

[0067] In order to make the technical solutions of the present application clearer and easier to understand, the system architecture of the present application will be introduced below in conjunction with the drawings.

[0068] Referring to FIG. 1, a system architecture provided by the present application is shown. The system architecture mainly includes two parts of a semantic adapter and a large language model. The semantic adapter serves as an encoder and mainly further extracts features from the modal feature vectors obtained by feature extraction of modal data to enhance the representation of the extracted data. In the embodiments of the present application, the large language model can be used as a decoder to decode the feature vectors obtained based on the semantic adapter through the large language model to obtain text data, and the semantic adapter can be trained according to the differences between the text data and the original samples to improve the accuracy of the feature vectors obtained by the semantic adapter. The trained semantic adapter can directly infer according to the modal feature vectors of the input data, and the obtained feature vectors can be directly used as input of the recommendation system.

[0069] In the training process, the parameters of the modal encoder and the large language model are fixed, and the parameters in the semantic adapter are fine-tuned, so as to complete the training of the semantic adapter.

[0070] FIG. 2 is a training flow of training the semantic adapter by taking the large language model as the decoder and an inference process of inferring the modal feature vector based on the semantic adapter. Among them, the large language model as the decoder only participates in the training process of training the semantic adapter, and only the trained semantic adapter needs to be deployed in the inference process. The trained semantic adapter is used for inference to obtain the feature vector for the recommendation system, and the large language model is not needed for inference. In FIG. 2, the solid arrow represents the inference process of inferring through the semantic adapter, and the dashed arrow represents the training process of training the semantic adapter by taking the large language model as the decoder.

[0071] Next, the method flow provided by the present application is introduced in combination with the foregoing system architecture.

[0072] Referring to FIG. 3, a flowchart of a model training method provided by the present application is as follows.

[0073] Step 301, feature extraction is performed on the first modal data to obtain a first modal feature vector;

[0074] The first modal data can be any one of text data, image data, or video data, and the specific modal data is not limited herein. Therefore, the first modal feature vector can be a text modal feature vector, an image modal feature vector, etc.

[0075] In the embodiments of the present application, the first modal data can be feature extracted by the modal encoder to obtain the first modal feature vector. Specifically, the text2vec or other text encoding technology can be used to extract information from the item text description to obtain the text modal feature vector of the item. The Vision Transformer (VIT) can also be used to extract information from the picture of the item to obtain the image modal feature vector of the item. In addition, if the first modal data obtained at this time is other modal data of the item, information extraction can be performed to obtain the corresponding modal feature vector. wherein n m The dimension d of the semantic adapter vector is determined by the modal encoder itself.

[0076] Step 302, the first modal feature vector and the query vector are analyzed by the semantic adapter to obtain a first information aggregation embedding vector;

[0077] In the embodiments of the present application, the semantic adapter is obtained by combining components based on the transformer structure, can include multiple units, each unit can include multiple modules, and each unit can include a multi-head self-attention module, a multi-head cross-attention module and a forward neural network, for example. The modal feature vector and the query vector are analyzed through the multiple modules in the semantic adapter to obtain the first information aggregation embedding vector.

[0078] The semantic adapter is mainly used for further feature extraction of the modal feature vector obtained by the modal encoder to realize knowledge enhancement of the modal feature vector. The semantic adapter can also adopt a Qformer structure, and the module combination in the semantic adapter can have multiple forms, which are not limited here. The query vector is a learnable vector, so the key information of the modal data can be extracted by continuously learning the features of the modal feature vector.

[0079] Specifically, the multi-head self-attention module can take the output of the previous unit (the first unit is X Q ) as input, pass through a multi-head self-attention network, introduce a residual structure, and then pass through layer normalization to obtain an intermediate layer implicit expression vector

[0080] Where LN is layer normalization, and MSA is a multi-head self-attention network.

[0081] Subsequently, the multi-head cross-attention module can use a dimension dxd projection matrix W q to map into a query vector Q; use a dimension dxd projection matrix W k and W v to map X M into a key vector K and a value vector V, respectively; and use a dxd projection matrix W o to map back to the original embedding vector dimension d of the model.

[0082] Finally, the output of this unit is obtained through the forward neural network module

[0083] Step 303, training the semantic adapter based on the generation result obtained by the generative artificial intelligence model based on the first information aggregation embedding vector, to obtain the trained semantic adapter.

[0084] After the semantic adapter analyzes the first modality feature vector and the query vector to obtain the first information aggregation embedding vector, the first information aggregation embedding vector can be decoded by a generative artificial intelligence model to obtain corresponding text data or image data. By comparing the decoded text data or image data with the original text data or image data, the semantic adapter can be trained according to the comparison result to obtain a trained semantic adapter.

[0085] Optionally, a large language model can be used as a decoder. First, the word vector dimension d of the large language model can be determined according to the word vector dimension d of the semantic adapter. llm The first information aggregation embedding vector Z is projected by a projection vector to obtain a third information aggregation embedding vector Then, the third information aggregation embedding vector can be inferred by the large language model to obtain the first text data of the third information aggregation embedding vector, that is, the corresponding text data is obtained by decoding the third information aggregation embedding vector. The parameters of the semantic adapter can be adjusted according to the first text data and the second text data corresponding to the first information aggregation embedding vector to obtain a trained semantic adapter.

[0086] The second text data can be the initial input text data, or a caption description of the initial input image data.

[0087] Specifically, when the large language model is used as a decoder, the text data obtained by decoding the large language model can be compared with the initial input text data, and can also be compared with the caption description of the image corresponding to the first information aggregation embedding vector. The parameters of the semantic adapter can be adjusted according to the difference between the text data and the initial input text data, or the difference between the text data and the caption description of the image, to obtain a trained semantic adapter.

[0088] In addition, other generative models can also be used as decoders, and the corresponding first image can be obtained by inferring the first information aggregation embedding vector based on the generative model. The parameters of the semantic adapter can be adjusted according to the first image and the second image (initial input image data) to obtain a trained semantic adapter.

[0089] ​Optionally, after obtaining the first text data, the parameters of the semantic adapter can be adjusted according to the difference between the first text data and the second text data until the difference between the first text data and the second text data is less than a preset value, and the parameter adjustment is stopped, and the trained semantic adapter is obtained. The difference between the first text data and the second text data can be calculated as the mean-square error (MSE) or the mean absolute error (MAE) of the first text data and the second text data.

[0090] Optionally, the trained semantic adapter can perform inference based on the second modal feature vector to obtain a second information aggregation embedding vector, the second modal feature vector being obtained by feature extraction on second modal data, the second modal data being any one of text data, image data or video data; the second information aggregation embedding vector can be used as an input of a recommendation model, and the recommendation model can perform inference on the second information aggregation embedding vector to obtain a recommendation result, which is used to display to a recommendation object. In addition, the obtained second information aggregation embedding vector can also be used as an input of other neural network models to complete other tasks and be applied to other scenarios. For example, in a search scenario, which is not limited here.

[0091] In the embodiments of the present application, a large language model or a generation model can be used as a decoder, and the large language model or the generation model can be used to perform sample reconstruction training on the data representation extracted by the semantic adapter. The data representation is decoded to obtain text data or image data, and then the semantic adapter can be trained according to the difference between the text data or image data and the original sample. The trained semantic adapter can be directly used to enhance the extracted modal data representation, and does not depend on the large language model. The efficiency of enhancing the representation can be improved when enhancing the effect of extracting the modal data representation, and then the high timeliness of the subsequent recommendation system based on the representation can be met.

[0092] For the mobile phone wallpaper recommendation application scenario, the semantic adapter obtained based on the model training method proposed in the embodiments of the present application extracts the information aggregation embedding vector of the mobile phone wallpaper, and the information aggregation embedding vector is used as the input of the recommendation system to obtain the recommended mobile phone wallpaper. The effect of the information aggregation embedding vector inferred by the recommendation system based on the semantic adapter is analyzed in offline and online scenarios, as shown in Tables 1 and 2.

[0093] Table 1 shows the baseline AUC and the AUC obtained based on the present scheme for different tasks in the offline scenario.

[0094] Table 1

[0095] As can be seen from Table 1, the semantic adapter of the present solution is used to obtain the feature vector as the input of the recommendation system, and the offline indicators AUC corresponding to different tasks are all improved, that is, the probability that the recommendation system predicts that the score of the positive sample (the item that the user is interested in) is higher than that of the negative sample (the item that the user is not interested in) is improved.

[0096] Table 2 is an online recommendation scenario of mobile phone wallpapers, in which the feature vector obtained based on the semantic adapter of the present solution is used as the input of the recommendation system, and the existing recommendation system solution is compared. The comparison results are shown in Table 2.

[0097] Table 2

[0098] As can be seen from Table 2, the effective viewing quantity, click rate, like rate and active user number of the mobile phone wallpapers recommended based on the present solution are all improved, which indicates that the data quality used for reasoning by the recommendation system is improved, and in turn indicates that the data features extracted by the semantic adapter of the present solution are enhanced.

[0099] The foregoing describes the method flow provided by the present application. Based on the foregoing method flow, the device provided by the present application is described below.

[0100] Referring to FIG. 4, the structure schematic diagram of a model training device provided by the present application is described as follows.

[0101] The extraction module 401 is configured to perform feature extraction on the first modality data to obtain a first modality feature vector.

[0102] The analysis module 402 is configured to analyze the first modality feature vector and a query vector by using a semantic adapter to obtain a first information aggregation embedding vector. The semantic adapter is configured to perform knowledge enhancement on the first modality feature vector. The query vector is configured to extract key features of the first modality data. The first information aggregation embedding vector is obtained by learning the query vector based on the first modality feature vector.

[0103] The training module 403 is configured to train the semantic adapter based on a generation result obtained by a generative artificial intelligence model based on the first information aggregation embedding vector to obtain a trained semantic adapter. The trained semantic adapter is configured to obtain a second information aggregation embedding vector based on a second modality feature vector. The second modality feature vector is obtained by performing feature extraction on second modality data.

[0104] In a possible implementation, the device can further include an inference module 404 configured to perform inference on the second modality feature vector by using the trained semantic adapter to obtain the second information aggregation embedding vector. The second information aggregation embedding vector is configured to indicate a recommendation result obtained by a recommendation model based on the second information aggregation embedding vector.

[0105] In a possible implementation, the first modal data described above includes text data or image data, and the training module 403 is specifically configured to: perform inference on the first information aggregation embedding vector by the large language model to obtain first text data; and train the semantic adapter according to second text data corresponding to the first information aggregation embedding vector and the first text data, to obtain the trained semantic adapter, the second text data being text data or image data.

[0106] In a possible implementation, the training module 403 is specifically configured to: perform linear projection on the first information aggregation embedding vector according to a word vector dimension of the large language model, to obtain a third information aggregation embedding vector; and perform inference on the third information aggregation embedding vector by the large language model, to obtain the first text data.

[0107] In a possible implementation, the training module 403 is specifically configured to: adjust parameters of the semantic adapter according to a difference between the first text data and the second text data, until the difference between the first text data and the second text data is less than a preset value, and stop adjusting the parameters, to obtain the trained semantic adapter.

[0108] In a possible implementation, the semantic adapter is an encoder obtained by combining components based on a transformer structure.

[0109] The embodiment of the present application also provides a computer readable storage medium, which stores a program, and when the program is run on a computer, the computer is caused to perform the steps in the method described in the embodiment as shown in FIG. 3.

[0110] The embodiment of the present application also provides a computer program product, which, when run on a computer, causes the computer to perform the steps in the method described in the embodiment as shown in FIG. 3.

[0111] In addition, it should be noted that the apparatus embodiments described above are only schematic, and the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment. In addition, the apparatus embodiments provided in the present application have a connection relationship between the modules, which indicates that there is a communication connection between them, which can be realized as one or more communication buses or signal lines.

[0112] Those skilled in the art can clearly understand the specific working process of the system, device and unit described above for the convenience and brevity of description, and can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0113] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0114] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0115] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0116] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.

[0117] The terms "first", "second", "third", "fourth", and the like in the description and in the claims of the present application, and above-mentioned drawings, if any, are used as identifiers for distinguishing between similar objects, and do not necessarily describe a particular chronological or sequential order. It will be understood that the use of such terms is arbitrary and made solely for the purpose of distinguishing between the similar objects. It is to be understood that data so used in the specification can be interchanged, under suitable circumstances, to convey a given embodiment described herein in an alternate order. Furthermore, the terms "comprising" and "including" and any of their derivatives, are intended to be construed as encompassing a non-exclusive inclusion, e.g., a process, method, system, product or apparatus that includes a list of steps or units as limitations can not necessarily be limited to the steps or units that are expressly listed, but can include other steps or units that are not expressly listed or inherent to such process, method, product or apparatus.

[0118] Finally, it should be noted that the above only is a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, which should be covered within the protection scope of the present application.

Claims

1. A model training method, characterized in that, The method comprises: performing feature extraction on first modal data to obtain a first modal feature vector; analyzing the first modal feature vector and a query vector by a semantic adapter to obtain a first information aggregation embedding vector, the semantic adapter being configured to perform knowledge enhancement on the first modal feature vector, the query vector being configured to extract key features of the first modal data, the first information aggregation embedding vector being obtained by learning the query vector based on the first modal feature vector; training the semantic adapter based on a generation result obtained by a generative artificial intelligence model based on the first information aggregation embedding vector to obtain a trained semantic adapter, the trained semantic adapter being configured to obtain a second information aggregation embedding vector based on a second modal feature vector, the second modal feature vector being obtained by performing feature extraction on second modal data.

2. The method of claim 1, wherein, The method further comprises: performing reasoning on the second modal feature vector by the trained semantic adapter to obtain the second information aggregation embedding vector, the second information aggregation embedding vector being configured to instruct a recommendation model to obtain a recommendation result by performing reasoning based on the second information aggregation embedding vector.

3. The method according to claim 1 or 2, characterized in that, The first modal data comprises text data or image data, and the training of the semantic adapter based on the generation result obtained by the generative artificial intelligence model based on the first information aggregation embedding vector to obtain the trained semantic adapter comprises: performing reasoning on the first information aggregation embedding vector by a large language model to obtain first text data; training the semantic adapter based on second text data corresponding to the first information aggregation embedding vector and the first text data to obtain the trained semantic adapter, the second text data being a text description of the text data or the image data.

4. The method of claim 3, wherein, The performing of reasoning on the first information aggregation embedding vector by the large language model to obtain the first text data comprises: performing linear projection on the first information aggregation embedding vector based on a word vector dimension of the large language model to obtain a third information aggregation embedding vector; performing reasoning on the third information aggregation embedding vector by the large language model to obtain the first text data.

5. The method according to claim 3 or 4, characterized in that, The training of the semantic adapter based on the second text data corresponding to the first information aggregation embedding vector and the first text data to obtain the trained semantic adapter comprises: adjusting parameters of the semantic adapter based on a difference between the first text data and the second text data until the difference between the first text data and the second text data is less than a preset value, and stopping adjusting the parameters to obtain the trained semantic adapter.

6. The method according to any one of claims 1 to 5, characterized in that, The semantic adapter is an encoder obtained by combining components based on a transformer structure.

7. A model training apparatus characterized by comprising: The method comprises: extracting a first modal feature vector by performing feature extraction on first modal data; The analysis module is configured to analyze the first modality feature vector and a query vector through a semantic adapter to obtain a first information aggregation embedding vector, the semantic adapter is configured to perform knowledge enhancement on the first modality feature vector, the query vector is configured to extract key features of the first modality data, and the first information aggregation embedding vector is obtained based on the first modality feature vector. The training module is configured to train the semantic adapter based on a generation result of the generative artificial intelligence model based on the first information aggregation embedding vector to obtain a trained semantic adapter, and the trained semantic adapter is configured to obtain a second information aggregation embedding vector based on a second modality feature vector, and the second modality feature vector is obtained by performing feature extraction on second modality data.

8. The apparatus of claim 7, wherein, The device further comprises: The inference module is configured to infer the second modality feature vector through the trained semantic adapter to obtain the second information aggregation embedding vector, and the second information aggregation embedding vector is configured to indicate a recommendation result obtained by a recommendation model based on the second information aggregation embedding vector.

9. The apparatus of claim 7 or 8, wherein, The first modality data includes text data or image data, and the training module is specifically configured to: infer first text data by a large language model based on the first information aggregation embedding vector; train the semantic adapter based on second text data corresponding to the first text data and the first information aggregation embedding vector to obtain the trained semantic adapter, and the second text data is a text description of the text data or the image data.

10. The apparatus of claim 9, wherein, The training module is specifically configured to: perform linear projection on the first information aggregation embedding vector based on a word vector dimension of the large language model to obtain a third information aggregation embedding vector; infer the first text data by the large language model based on the third information aggregation embedding vector.

11. The apparatus of claim 9 or 10, wherein, The training module is specifically configured to: adjust parameters of the semantic adapter based on a difference between the first text data and the second text data until the difference between the first text data and the second text data is less than a preset value, stop adjusting the parameters, and obtain the trained semantic adapter.

12. The apparatus of any one of claims 7-11, wherein, The semantic adapter is an encoder obtained by combining components based on a transformer structure.

13. A model training apparatus, comprising: It comprises: a processor and a memory, the processor being coupled to the memory; the memory is configured to store a program; the processor is configured to execute the program in the memory, so as to execute the method in any one of claims 1 to 6.

14. A computer-readable storage medium, characterized in that, instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 6.

15. A computer program product comprising instructions, characterized in that, instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Natural language processing method, language model training method and related equipment

    CN114781611A

  • Information recommendation model training method, information recommendation method and equipment

    CN116108282A

  • Generative dialogue method and system based on multi-modal knowledge enhancement

    CN116450787A

  • Recommended text generation model training method and device, equipment and medium

    CN117216535A

  • Method and apparatus for generating language model using crossmodal information

    US20240176959A1