A method and apparatus for understanding user representation based on a language model

CN119005348BActive Publication Date: 2026-09-22ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411090577.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2026-09-22
Estimated Expiration
2044-08-08

AI Technical Summary

Technical Problem

[0002]用户表征是指人工智能算法中对于用户的抽象表示,上述用户表征被使用在多种领域的算法中,例如,推荐系统算法、用户画像算法等;但是当前用户表征的相关算法模型缺乏解释性,无法在应用层面上针对上述用户表征提供解释;从用户的角度来说,用户只能得到算法模型的结果,却无法得知算法模型提供结果的原因,例如,用户被推荐了某个商品,却无法得知自己在算法模型中是如何被理解的,这会影响用户对算法模型输出结果的信服力

Benefits of technology

[0069]本发明实施例中,通过获取第一用户表征,其中,所述用户表征为设定算法中对于用户的向量表示;将所述第一用户表征输入到Q-Transformer模型,生成第二用户表征,其中,所述第二用户表征中包括所述第一用户表征中的部分信息;将所述第二用户表征输入到独立线性层,通过向量空间转换生成第三用户表征,其中,所述第三用户表征的向量表示为大规模语言模型可使用的向量空间格式;将所述第三用户表征和第一问题信息输入到所述大规模语言模型,生成用户表征理解文本。通过上述方法,使大规模语言模型输出理解用户表征的自然语言文本,实现了人工智能算法中用户表征的可解释性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119005348B_ABST
    Figure CN119005348B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method and device for understanding user representation based on a language model. In the embodiments of the present application, a first user representation is obtained, wherein the user representation is a vector representation of a user in a set algorithm; the first user representation is input into a query transformer Q-Transformer model to generate a second user representation, wherein the second user representation includes part of the information in the first user representation; the second user representation is input into an independent linear layer to generate a third user representation through vector space conversion, wherein the vector representation of the third user representation is in a vector space format available for a large-scale language model; and the third user representation and first question information are input into the large-scale language model to generate a user representation understanding text. Through the above method, the large-scale language model outputs a natural language text that understands the user representation, and the user representation in the artificial intelligence algorithm is made interpretable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to a method and apparatus for understanding user representations based on language models. Background Technology

[0002] User representation refers to the abstract representation of a user in artificial intelligence algorithms. These user representations are used in algorithms across various fields, such as recommendation system algorithms and user profiling algorithms. However, current algorithmic models related to user representation lack interpretability and cannot provide explanations for these user representations at the application level. From the user's perspective, the user can only obtain the results of the algorithmic model but cannot understand the reasons why the algorithmic model provides those results. For example, a user may be recommended a product but cannot understand how they are understood in the algorithmic model, which affects the user's confidence in the algorithmic model's output.

[0003] With the development of large-scale language models, these models have shown amazing results in various applications, especially in knowledge memorization, text understanding, and text generation. However, existing large-scale language models can usually only understand text modalities and cannot directly understand user representations in algorithmic models.

[0004] In summary, how to understand user representations based on large-scale language models is a problem that needs to be solved. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a method and apparatus for understanding user representations based on language models, enabling large-scale language models to output natural language text that understands user representations, thereby realizing the interpretability of user representations in artificial intelligence algorithms.

[0006] In a first aspect, embodiments of the present invention provide a method for understanding user representations based on a language model, the method comprising:

[0007] Obtain a first user representation, wherein the user representation is a vector representation of the user in the given algorithm;

[0008] The first user representation is input into the query transformer Q-Transformer model to generate a second user representation, wherein the second user representation includes some information from the first user representation;

[0009] The second user representation is input into an independent linear layer, and a third user representation is generated through vector space transformation, wherein the vector representation of the third user representation is in a vector space format that can be used by large-scale language models.

[0010] The third user representation and the first question information are input into the large-scale language model to generate user representation understanding text.

[0011] Optionally, the method further includes:

[0012] Save the third user representation.

[0013] Optionally, the method further includes:

[0014] The second problem information is input into the large-scale language model;

[0015] Based on the second question information, the third user representation, and the first question information, a deep understanding text of the user representation is generated.

[0016] Optionally, obtaining the first user representation specifically includes:

[0017] Obtain basic user information;

[0018] The user's basic information is input into the user representation generator to generate the first user representation.

[0019] Optionally, the step of inputting the first user representation into the Q-Transformer model to generate the second user representation specifically includes:

[0020] The first user representation is input into the linear layer of the Q-Transformer model, and an intermediate user representation is generated through vector space transformation, wherein the vector representation of the intermediate user representation is in a vector space format that can be used by the Q-Transformer model;

[0021] The second user representation is generated based on the intermediate user representation and the learnable vectors of the Q-Transformer model.

[0022] Optionally, the training process of the Q-Transformer model includes:

[0023] Obtain user representation samples and descriptive text samples;

[0024] The parameters of the Q-Transformer model are updated based on the user representation samples and descriptive text samples.

[0025] Optionally, updating the parameters of the Q-Transformer model based on the user representation samples and descriptive text samples specifically includes:

[0026] The user representation samples and descriptive text samples are subjected to comparative learning tasks, matching tasks, and text generation tasks to update the parameters of the Q-Transformer model and the learnable vectors of the Q-Transformer model.

[0027] Optionally, the method further includes:

[0028] The user representation samples are input into the linear layer of the Q-Transformer model through a cross-attention layer, and intermediate user representation samples are generated through vector space transformation. The vector representation of the intermediate user representation samples is in a vector space format that can be used by the Q-Transformer model.

[0029] The descriptive text sample is input into the Q-Transformer model through the input layer.

[0030] Optionally, the method further includes:

[0031] The descriptive text samples are generated based on a large-scale language model.

[0032] Optionally, the method further includes:

[0033] The intermediate user representation samples are input into an independent linear layer, and target user representation samples are generated through vector space transformation, wherein the vector representation of the target user representation samples is in a vector space format that can be used by large-scale language models;

[0034] The target user representation sample and the question information sample are input into the large-scale language model to generate user representation understanding text samples.

[0035] The user representation understanding text sample is compared with the description text sample to update the parameters of the Q-Transformer model and the independent linear layer.

[0036] Secondly, embodiments of the present invention provide an apparatus for understanding user representations based on a language model, the apparatus comprising:

[0037] An acquisition unit is used to acquire a first user representation, wherein the user representation is a vector representation of the user in a given algorithm;

[0038] The first generation unit is used to input the first user representation into the query transformer Q-Transformer model to generate a second user representation, wherein the second user representation includes some information from the first user representation;

[0039] The second generation unit is used to input the second user representation into an independent linear layer and generate a third user representation through vector space transformation, wherein the vector representation of the third user representation is in a vector space format that can be used by large-scale language models.

[0040] The third generation unit is used to input the third user representation and the first question information into the large-scale language model to generate user representation understanding text.

[0041] Optionally, the device may also include:

[0042] A storage unit is used to store the third user representation.

[0043] Optionally, the third generation unit is further configured to:

[0044] The second problem information is input into the large-scale language model;

[0045] Based on the second question information, the third user representation, and the first question information, a deep understanding text of the user representation is generated.

[0046] Optionally, the acquisition unit is specifically used for:

[0047] Obtain basic user information;

[0048] The user's basic information is input into the user representation generator to generate the first user representation.

[0049] Optionally, the first generation unit is specifically used for:

[0050] The first user representation is input into the linear layer of the Q-Transformer model, and an intermediate user representation is generated through vector space transformation, wherein the vector representation of the intermediate user representation is in a vector space format that can be used by the Q-Transformer model;

[0051] The second user representation is generated based on the intermediate user representation and the learnable vectors of the Q-Transformer model.

[0052] Optionally, during the training of the Q-Transformer model, the acquisition unit is further used for:

[0053] Obtain user representation samples and descriptive text samples;

[0054] The device further includes:

[0055] An update unit is used to update the parameters of the Q-Transformer model based on the user representation samples and description text samples.

[0056] Optionally, the update unit is specifically used for:

[0057] The user representation samples and descriptive text samples are subjected to comparative learning tasks, matching tasks, and text generation tasks to update the parameters of the Q-Transformer model and the learnable vectors of the Q-Transformer model.

[0058] Optionally, the device further includes:

[0059] The input unit is used to input the user representation sample into the linear layer of the Q-Transformer model through a cross-attention layer, and generate intermediate user representation samples through vector space transformation, wherein the vector representation of the intermediate user representation sample is in a vector space format that can be used by the Q-Transformer model;

[0060] The descriptive text sample is input into the Q-Transformer model through the input layer.

[0061] Optionally, the device further includes:

[0062] The fourth generation unit is used to generate the descriptive text sample based on a large-scale language model.

[0063] Optionally, the update unit is further configured to:

[0064] The intermediate user representation samples are input into an independent linear layer, and target user representation samples are generated through vector space transformation, wherein the vector representation of the target user representation samples is in a vector space format that can be used by large-scale language models;

[0065] The target user representation sample and the question information sample are input into the large-scale language model to generate user representation understanding text samples.

[0066] The user representation understanding text sample is compared with the description text sample to update the parameters of the Q-Transformer model and the independent linear layer.

[0067] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect or any one of the possible methods of the first aspect.

[0068] Fourthly, embodiments of the present invention provide a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the method as described in the first aspect or any one of the possibilities of the first aspect.

[0069] In this embodiment of the invention, a first user representation is obtained, wherein the user representation is a vector representation of the user in a given algorithm; the first user representation is input into a Q-Transformer model to generate a second user representation, wherein the second user representation includes some information from the first user representation; the second user representation is input into an independent linear layer, and a third user representation is generated through vector space transformation, wherein the vector representation of the third user representation is a vector space format usable by a large-scale language model; the third user representation and the first question information are input into the large-scale language model to generate user representation-understanding text. Through the above method, the large-scale language model outputs natural language text that understands the user representation, realizing the interpretability of user representations in artificial intelligence algorithms. Attached Figure Description

[0070] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which:

[0071] Figure 1 This is a flowchart of a method for understanding user representations based on a language model, as described in an embodiment of the present invention.

[0072] Figure 2 This is a flowchart of another method for understanding user representations based on a language model in an embodiment of the present invention;

[0073] Figure 3 This is a flowchart of another method for understanding user representations based on a language model in this embodiment of the invention;

[0074] Figure 4 This is a schematic diagram of a system for generating user representation understanding text in an embodiment of the present invention;

[0075] Figure 5 This is a flowchart illustrating the training process of a Q-Transformer model according to an embodiment of the present invention.

[0076] Figure 6 This is a flowchart illustrating the training process of another Q-Transformer model in this embodiment of the invention.

[0077] Figure 7 This is a schematic diagram of a system for training and generating user representations to understand text, as described in an embodiment of the present invention.

[0078] Figure 8 This is a schematic diagram of a device for understanding user representations based on a language model, according to an embodiment of the present invention.

[0079] Figure 9This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0080] The present application is described below based on embodiments, but it is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without these details. To avoid obscuring the substance of the present application, well-known methods, processes, flows, elements, and circuits are not described in detail.

[0081] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.

[0082] Unless the context explicitly requires it, words such as "including" or "contains" throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".

[0083] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0084] In existing technologies, user representation refers to the abstract representation of a user in artificial intelligence algorithms. This abstract representation is a multi-dimensional numerical vector, such as a 256-dimensional numerical vector. User representations are used in algorithms across various fields, such as recommendation system algorithms and user profiling algorithms. However, current algorithmic models related to user representations lack interpretability and cannot provide explanations for these user representations at the application level; that is, they cannot interpret the multi-dimensional numerical vectors. From the user's perspective, the user can only obtain the results of the algorithmic model corresponding to the recommendation system algorithm, but cannot know the specific reasons why the algorithmic model provides those results. For example, the recommendation system algorithm recommends a product to a user, but the user cannot know how they are understood within the algorithmic model, which affects the user's confidence in the algorithmic model's output. With the development of large-scale language models (LLMs), these models have demonstrated remarkable performance in various applications, particularly in knowledge memorization, text understanding, and text generation. These LLMs are language models constructed from deep neural networks containing hundreds of billions of parameters, trained using self-supervised learning methods on large amounts of unlabeled text. They are capable of handling diverse natural language tasks and represent an important pathway to artificial intelligence. Models such as BERT and GPT have driven the development of LLMs. Specifically, when applied to ChatGPT, these LLMs can engage in natural and fluent dialogue with users, answering various questions. In this application, the LLMs can also be simply referred to as language models. Although LLMs have wide applications, existing models typically only understand textual modalities and cannot directly understand user representations within the algorithmic model. Therefore, how to understand user representations based on LLMs and enable them to output natural language text that understands these representations is a problem that needs to be solved.

[0085] In this embodiment of the invention, to address the aforementioned problems, a method for understanding user representations based on language models is proposed, specifically as follows: Figure 1 As shown, the method includes:

[0086] Step S101: Obtain the first user representation, wherein the user representation is a vector representation of the user in the set algorithm.

[0087] Specifically, the setting algorithm is an artificial intelligence algorithm, and the user representation is an abstract representation of the user in the artificial intelligence algorithm. The abstract representation can also be called a vector representation, vector space, vector, etc. The first user representation is a multi-dimensional vector, such as 256-dimensional, 512-dimensional, etc., which is determined according to the actual situation.

[0088] In this embodiment of the invention, it is assumed that the first user representation is a 256-dimensional vector specifically (0.4, 06, 0.5, 0.4...), a total of 256 dimensional numbers, which will not be elaborated here.

[0089] In one possible implementation, the first user representation is obtained through a user representation generator.

[0090] Step S102: Input the first user representation into the query transformer Q-Transformer model to generate a second user representation, wherein the second user representation includes some information from the first user representation.

[0091] Specifically, the user representation generator inputs the first user representation into the query converter. The Transformer (Q-Transformer) model is a deep learning model that takes learnable vectors (queries) as input. These queries can extract information related to the user representation text from the first user representation, i.e., extracting partial information from the first user representation to generate a second user representation. The Transformer model is an attention-based deep learning model used for natural language processing tasks. The training process of the Q-Transformer model is the same as that of the Transformer model, including forward propagation, loss calculation, backpropagation, and optimization calculation. Specifically, it includes: first, inputting preprocessed data into the Transformer model, and obtaining the output of the Transformer model through multiple layers of encoder and decoder; then, calculating the loss function based on the difference between the output generated by the Transformer model and the target sequence, where the loss function includes cross-entropy loss, etc.; then, using the gradient information of the loss function, updating the Transformer model parameters through the backpropagation algorithm to minimize the loss function; finally, using the optimization algorithm to iteratively adjust the Transformer model parameters, ultimately completing the training of the Transformer model.

[0092] In this embodiment of the invention, although the Q-Transformer model is an available open-source model, it is not easy to conceive of inputting a first user representation into the Q-Transformer model and generating a second user representation through the Q-Transformer model.

[0093] In this embodiment of the invention, the step of inputting the first user representation into the query transformer Q-Transformer model to generate the second user representation specifically includes:

[0094] The first user representation is input into a linear layer of the Q-Transformer model, and an intermediate user representation is generated through vector space transformation, wherein the vector representation of the intermediate user representation is in a vector space format that can be used by the Q-Transformer model; the second user representation is generated based on the intermediate user representation and the learnable vectors of the Q-Transformer model.

[0095] Specifically, the first user representation is input into the linear layer of the Q-Transformer model through a cross-attention layer. Since the vector length of the first user representation is different from the vector length that the Q-Transformer model can handle, the linear layer of the Q-Transformer model aligns the vector length of the first user representation with the vector length that the Q-Transformer model can handle, i.e., performs vector space transformation, converting the first user representation into an intermediate user representation. The learnable vector queries of the Q-Transformer model extract information related to the descriptive text of the first user representation from the intermediate user representation to generate the second user representation, which is also represented by vectors.

[0096] Step S103: Input the second user representation into an independent linear layer and generate a third user representation through vector space transformation, wherein the vector representation of the third user representation is in a vector space format that can be used by a large-scale language model.

[0097] In this embodiment of the invention, the independent linear layer is located independently in the middle position outside the Q-Transformer model and the large-scale language model. Since the vector length of the second user representation is different from the vector length that can be processed in the large-scale language model, the independent linear layer aligns the vector length of the second user representation with the length of the vector that can be processed in the large-scale language model (also known as the usable vector), that is, it performs vector space transformation, converting the second user representation into a third user representation, which is also represented by vectors.

[0098] Step S104: Input the third user representation and the first question information into the large-scale language model to generate user representation understanding text.

[0099] In one possible implementation, the first question information can also be called a first prompt. The third user representation and the first question information are concatenated and input into the large-scale language model. For example, the first question information is "What kind of person is this user?", and the content concatenated with the third user representation and the first question information is "[Third user representation], what kind of person is this user?". "[Third user representation], what kind of person is this user?" is input into the large-scale language model to generate user representation understanding text, that is, natural language text that the user can understand. The generated user representation understanding text is specifically "This user may be a person who values ​​quality of life, likes decoration and plum blossom environment, he may like to buy various furniture users and...".

[0100] In this embodiment of the invention, in order to further explore deeper levels of user information, other steps are set after step S104, specifically as follows: Figure 2 As shown, Figure 2 This is another method based on language models to understand user representations, which includes the following steps:

[0101] Step S105: Save the third user representation.

[0102] Specifically, the third user representation is saved into the large-scale language model.

[0103] Step S106: Input the second problem information into the large-scale language model.

[0104] In this embodiment of the invention, in order to further mine deeper user information by utilizing the internal knowledge of the large language model through multi-round interactions, the second question information is input into the large-scale language model.

[0105] Specifically, the second question could be, "He might be a person who values ​​quality of life because of what products he has purchased?"

[0106] Step S107: Generate user representation deep understanding text based on the second question information, the third user representation, and the first question information.

[0107] Specifically, by combining the second question information, the third user representation, and the first question information, the large-scale language model generates the user representation deep understanding text through the combination of the second question information, the third user representation, and the first question information.

[0108] In this embodiment of the invention, after obtaining the user representation deep understanding text, the large-scale language model can continue to obtain third question information and generate the answer corresponding to the third question information. That is, it generates new user representation deep understanding text based on the third question information, the third user representation, and the content of previous interactions, and so on.

[0109] Using the methods described above, deeper levels of user information can be extracted by leveraging the internal knowledge of a large language model through multiple rounds of interaction.

[0110] In this embodiment of the invention, before step S102, step S101 can be replaced by two steps. Specifically, as follows: Figure 3 As shown, Figure 3 This is yet another method for understanding user representations based on language models, which includes the following steps:

[0111] Step S108: Obtain basic user information.

[0112] In this embodiment of the invention, the basic user information includes the user's personal information, historical interactive products, historical behavior records, etc. Specifically, the user representation generator collects the user's personal information, historical interactive products, historical behavior records, etc.

[0113] Step S109: Input the user's basic information into the user representation generator to generate the first user representation.

[0114] Specifically, the user's personal information, historical interactive products, historical behavior records, etc., are input into the user representation generator to generate the first user representation.

[0115] In this embodiment of the invention, as can be seen from the above embodiments, based on the user representation generator, the Q-Transformer model, the independent linear layer, and the large-scale language model, the user representation generated by the user representation generator is transformed into a vector space through the Q-Transformer model and the independent linear layer, and then input into the large-scale language model to generate natural language text that the user can understand, that is, the user representation understanding text.

[0116] In one possible implementation, the system for generating user representation-understanding text is as follows: Figure 4As shown, it includes a user representation generator 401, a Q-Transformer model 402, independent linear layers 403, and a large-scale language model 404. The input of the Q-Transformer model 402 includes not only the user representation generated by the user representation generator 401, but also learnable vector queries. The large-scale language model 404 receives the output of the independent linear layers 403 and the question information Q as input. Specifically, the learnable vector queries can also be regarded as part of the Q-Transformer model 402.

[0117] In the above processing flow, the user representation generator and the Q-Transformer model do not need to be trained. The parameters of the user representation generator and the Q-Transformer model are frozen during training. The system can be connected to any user representation generator, which can use any user representation algorithm to generate user representations. The system can also be connected to any large-scale language model. The better the user representation algorithm and the large-scale language model, the better the effect of user representation understanding will be. Furthermore, changing the user representation algorithm and the large-scale language model will not lead to an increase in the computational resources required during training, because in this embodiment of the invention, only the Q-Transformer model and independent linear layers need to be trained.

[0118] In this embodiment of the invention, the training process of the Q-Transformer model is specifically as follows: Figure 5 As shown, it includes the following steps:

[0119] Step S501: Obtain user representation samples and descriptive text samples.

[0120] In this embodiment of the invention, the user representation generator obtains basic user information, including the user's personal information, historical interactive products, historical behavior records, etc., and generates the user representation sample based on the basic user information. The user representation sample is an abstract representation of the user in an artificial intelligence algorithm, and the user representation sample is a multi-dimensional vector.

[0121] In one possible implementation, the user representation generator is a user representation algorithm being used in the application scenario. The application scenario can be a recommendation system, a user profiling system, etc., and the specific method is determined according to the actual situation.

[0122] In this embodiment of the invention, the descriptive text sample can be constructed from the user's personal information, historical interactive products, and historical behavior records. Specifically, during the construction process, a portion of the user's personal information, historical interactive products, and historical behavior records is selected.

[0123] In one possible implementation, if the text length of the user's historical interaction behavior may be too long, the descriptive text sample can be generated based on a large-scale language model, wherein the user's historical interaction behavior is the user's personal information, historical interactive products, historical behavior records, etc.

[0124] Specifically, the prompt text is first constructed, and then input into a pre-trained large-scale language model, which outputs the descriptive text sample. The prompt text could be as follows: "This user has previously purchased [historical purchased items], this user is a cat lover," where "[historical purchased items]" refers to the sequence of names of items the user has previously purchased. The output descriptive text sample is "This user is a cat lover." This is merely an illustrative example; the specific prompt text constructed will be determined based on the actual situation. The large-scale language model used here is only for generating descriptive text samples and is not the same model used to generate user representation and understanding text.

[0125] Step S502: Update the parameters of the Q-Transformer model based on the user representation samples and description text samples.

[0126] Specifically, the user representation samples and descriptive text samples are subjected to comparative learning tasks, matching tasks, and text generation tasks to update the parameters of the Q-Transformer model and the learnable vectors of the Q-Transformer model.

[0127] In this embodiment of the invention, the user representation sample is input into the linear layer of the Q-Transformer model through a cross-attention layer, and intermediate user representation samples are generated through vector space transformation, wherein the vector representation of the intermediate user representation sample is in a vector space format that the Q-Transformer model can use; the descriptive text sample is input into the Q-Transformer model through an input layer.

[0128] The step of performing comparative learning, matching, and text generation tasks on the user representation samples and description text samples specifically includes: performing comparative learning, matching, and text generation tasks on the intermediate user representation samples and description text samples; wherein, the comparative learning task is specifically as follows: the intermediate user representation samples and description text samples respectively obtain output data through the Q-Transformer model, the output data corresponding to the intermediate user representation samples and description text samples are compared, and the parameters of the Q-Transformer model and the learnable vectors of the Q-Transformer model are updated; the matching task is specifically as follows: the intermediate user representation samples... The text generation task involves forming positive and negative sample pairs with the description text samples. These pairs are then input into the Q-Transformer model to predict matching relationships and update the parameters of the Q-Transformer model and its learnable vectors. The specific process of the text generation task is as follows: the intermediate user representation samples and the description text samples are fused at the self-attention layer of the Q-Transformer model, and then the description text is predicted. This process generates and updates the parameters of the Q-Transformer model and its learnable vectors.

[0129] In this embodiment of the invention, after updating the parameters of the Q-Transformer model in step S502, the Q-Transformer model completes the first stage of training. The Q-Transformer model is then initialized with the updated parameters, and the second stage of training begins. Specifically, the training process of the Q-Transformer model is as follows: Figure 6 As shown, after step S502, the following steps are also included:

[0130] Step S503: Input the intermediate user representation sample into an independent linear layer, and generate the target user representation sample through vector space transformation, wherein the vector representation of the target user representation sample is in a vector space format that can be used by a large-scale language model.

[0131] In this embodiment of the invention, the independent linear layer is located independently between the Q-Transformer model and the large-scale language model, that is, it does not belong to the Q-Transformer model nor to the large-scale language model. Since the vector length of the intermediate user representation sample is different from the vector length that can be processed in the large-scale language model, the independent linear layer aligns the vector length of the intermediate user representation sample with the vector length that can be processed in the large-scale language model, that is, it performs vector space transformation, converting the intermediate user representation sample into the target user representation sample, which is also represented by a vector.

[0132] Step S504: Input the target user representation sample and the question information sample into the large-scale language model to generate user representation understanding text samples.

[0133] In one possible implementation, the question information sample can also be called a prompt. The target user representation sample and the question information sample are concatenated and then input into the large-scale language model. For example, the question information sample is "What kind of person is this user?", and the content after concatenating the target user representation sample and the question information sample is "[Target User Representation Sample], What kind of person is this user?". The "[Third User Representation], What kind of person is this user?" is input into the large-scale language model, and the large-scale language model generates a user description task, that is, generates a user representation understanding text sample. For example, the generated user representation understanding text sample is "This user is a person who likes pets".

[0134] Step S505: Compare the user representation understanding text sample with the description text sample, and update the parameters of the Q-Transformer model and the independent linear layer.

[0135] Specifically, the user representation understanding text sample is compared with the description text sample to determine the loss of the Q-Transformer model and the independent linear layer, and then the parameters of the Q-Transformer model and the independent linear layer are updated.

[0136] For example, the user representation understanding text sample "This user is a person who likes pets" is compared with the description text sample "This user is a person who loves cats".

[0137] In one possible implementation, the system for training the user representation understanding text is as follows: Figure 7As shown, the system includes a user representation generator 701, a Q-Transformer model 702, independent linear layers 703, and a large-scale language model 704. The Q-Transformer model 702 receives user representations generated by the user representation generator 701, as well as learnable vector queries and descriptive text. The large-scale language model 704 receives the output of the independent linear layers 703 and question information Q as input. Specifically, the learnable vector queries can also be considered part of the Q-Transformer model 702.

[0138] Through the above embodiments, a method for understanding user representations based on language models is provided, outputting the understanding of user representations in the form of natural language text. This provides a new solution for the interpretability of artificial intelligence. Furthermore, the parameters of the user representation algorithm and the large-scale language model do not need to be involved in training, resulting in less resource required during training, faster training speed, and higher availability. New user representations can be directly understood through the trained Q-Transformer model and the untrained large-scale language model, and the implicit information in user representations can be understood through the large language model.

[0139] In this embodiment of the invention, a device for understanding user representations based on a language model is provided, such as... Figure 8 As shown, the system specifically includes: an acquisition unit 801, a first generation unit 802, a second generation unit 803, and a third generation unit 804. The acquisition unit 801 is used to acquire a first user representation, wherein the user representation is a vector representation of the user in a given algorithm. The first generation unit 802 is used to input the first user representation into a Q-Transformer model to generate a second user representation, wherein the second user representation includes some information from the first user representation. The second generation unit 803 is used to input the second user representation into an independent linear layer and generate a third user representation through vector space transformation, wherein the vector representation of the third user representation is a vector space format usable by a large-scale language model. The third generation unit 804 is used to input the third user representation and the first question information into the large-scale language model to generate user representation-understood text.

[0140] Furthermore, the device also includes:

[0141] A storage unit is used to store the third user representation.

[0142] Furthermore, the third generation unit is also used for:

[0143] The second problem information is input into the large-scale language model;

[0144] Based on the second question information, the third user representation, and the first question information, a deep understanding text of the user representation is generated.

[0145] Furthermore, the acquisition unit is also used for:

[0146] Obtain basic user information;

[0147] The user's basic information is input into the user representation generator to generate the first user representation.

[0148] Furthermore, the first generation unit is specifically used for:

[0149] The first user representation is input into the linear layer of the Q-Transformer model, and an intermediate user representation is generated through vector space transformation, wherein the vector representation of the intermediate user representation is in a vector space format that can be used by the Q-Transformer model;

[0150] The second user representation is generated based on the intermediate user representation and the learnable vectors of the Q-Transformer model.

[0151] Furthermore, during the training process of the Q-Transformer model, the acquisition unit is also used for:

[0152] Obtain user representation samples and descriptive text samples;

[0153] The device further includes:

[0154] An update unit is used to update the parameters of the Q-Transformer model based on the user representation samples and description text samples.

[0155] Furthermore, the update unit is specifically used for:

[0156] The user representation samples and descriptive text samples are subjected to comparative learning tasks, matching tasks, and text generation tasks to update the parameters of the Q-Transformer model and the learnable vectors of the Q-Transformer model.

[0157] Furthermore, the device also includes:

[0158] The input unit is used to input the user representation sample into the linear layer of the Q-Transformer model through a cross-attention layer, and generate intermediate user representation samples through vector space transformation, wherein the vector representation of the intermediate user representation sample is in a vector space format that can be used by the Q-Transformer model;

[0159] The descriptive text sample is input into the Q-Transformer model through the input layer.

[0160] Furthermore, the device also includes:

[0161] The fourth generation unit is used to generate the descriptive text sample based on a large-scale language model.

[0162] Furthermore, the updating unit is also used for:

[0163] The intermediate user representation samples are input into an independent linear layer, and target user representation samples are generated through vector space transformation, wherein the vector representation of the target user representation samples is in a vector space format that can be used by large-scale language models;

[0164] The target user representation sample and the question information sample are input into the large-scale language model to generate user representation understanding text samples.

[0165] The user representation understanding text sample is compared with the description text sample to update the parameters of the Q-Transformer model and the independent linear layer.

[0166] In one possible implementation, the method for understanding user representations based on language models is implemented using the BLIP2 framework open-source code.

[0167] Figure 9 This is a schematic diagram of the structure of the electronic device described in an embodiment of the present invention. Figure 9As shown, it includes a general computer hardware architecture, which includes at least a processor 901 and a memory 902. The processor 901 and the memory 902 are connected via a bus 903. The memory 902 is adapted to store instructions or programs executable by the processor 901. The processor 901 can be a standalone microprocessor or a collection of one or more microprocessors. Thus, the processor 901 executes the instructions stored in the memory 902 to perform the method flow of the embodiments of the present invention as described above, thereby realizing data processing and control of other devices. The bus 903 connects the above-mentioned components together, and also connects the above-mentioned components to a display controller 904, a display device, and an input / output (I / O) device 905. The input / output (I / O) device 905 can be a mouse, keyboard, modem, network interface, touch input device, motion-sensing input device, printer, and other devices known in the art. Typically, the input / output device 905 is connected to the system via an input / output (I / O) controller 906.

[0168] The instructions stored in memory 902 are executed by at least one processor 901 to: acquire a first user representation, wherein the user representation is a vector representation of the user in a given algorithm; input the first user representation into a Q-Transformer model to generate a second user representation, wherein the second user representation includes some information from the first user representation; input the second user representation into an independent linear layer and generate a third user representation through vector space transformation, wherein the vector representation of the third user representation is a vector space format usable by a large-scale language model; input the third user representation and the first question information into the large-scale language model to generate user representation-understood text.

[0169] Specifically, the electronic device includes: one or more processors 901 and a memory 902. Figure 9 Take processor 901 as an example. Processor 901 and memory 902 can be connected via a bus or other means. Figure 9 Taking a bus connection as an example, memory 902, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Processor 901 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions, and modules stored in memory 902, thereby realizing the aforementioned method for understanding user representations based on a large-scale language model.

[0170] Memory 902 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; the data storage area may store an option list, etc. Furthermore, memory 902 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 902 may optionally include memory remotely located relative to processor 901, and these remote memories may be connected to external devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0171] One or more modules are stored in memory 902 and, when executed by one or more processors 901, perform the method for understanding user representations based on a large-scale language model in any of the above method embodiments.

[0172] As those skilled in the art will recognize, various aspects of the embodiments of the present invention can be implemented as a system, method, or computer program product. Therefore, various aspects of the embodiments of the present invention can take the form of a completely hardware implementation, a completely software implementation (including firmware, resident software, microcode, etc.), or an implementation combining software and hardware aspects, which may generally be referred to herein as a "circuit," "module," or "system." Furthermore, various aspects of the embodiments of the present invention can take the form of a computer program product implemented in one or more computer-readable media having computer-readable program code implemented thereon.

[0173] Any combination of one or more computer-readable media can be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, (but not limited to) an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination thereof. More specific examples (not an exhaustive list) of computer-readable storage media will include: an electrical connection having one or more wires, a portable computer floppy disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable optical disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the context of embodiments of the present invention, a computer-readable storage medium can be any tangible medium capable of containing or storing a program used by or in conjunction with an instruction execution system, device, or apparatus.

[0174] Computer-readable signal media may include propagated digital signals having computer-readable program code implemented therein, such as in baseband or as part of a carrier wave. Such propagated signals may take any of a variety of forms, including, but not limited to, electromagnetic, optical, or any suitable combination thereof. A computer-readable signal medium may be any computer-readable medium that is not a computer-readable storage medium and can communicate, propagate, or transmit a program used by or in conjunction with an instruction execution system, device, or apparatus.

[0175] Program code implemented on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, fiber optic cable, RF, or any suitable combination thereof.

[0176] Computer program code for performing operations relating to various aspects of embodiments of the present invention can be written in any combination of one or more programming languages, including: object-oriented programming languages ​​such as Java, Smalltalk, C++, etc.; and conventional procedural programming languages ​​such as the "C" programming language or similar programming languages. The program code can be executed as a standalone software package entirely on the user's computer, partially on the user's computer, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet provided by an Internet service provider).

[0177] The flowchart illustrations and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention describe various aspects of the embodiments of the present invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus to produce a machine such that the instructions (executed via the processor of the computer or other programmable data processing apparatus) create means for implementing the functions / actions specified in the flowchart and / or block diagram blocks or blocks.

[0178] These computer program instructions may also be stored in a computer-readable medium that can direct a computer, other programmable data processing apparatus or other means to operate in a particular manner, such that the instructions stored in the computer-readable medium produce an article of writing that includes instructions that implement the functions / actions specified in flowchart and / or block diagram blocks or blocks.

[0179] Computer program instructions may also be loaded onto a computer, other programmable data processing apparatus or other device to cause a series of operable steps to be performed on the computer, other programmable apparatus or other device to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide for implementing the functions / actions specified in flowchart and / or block diagram blocks or blocks.

[0180] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

[0181] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of such data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding access points are provided for users to choose to authorize or refuse processing. A user's refusal to process personal information beyond what is necessary for basic functions will not affect the user's use of basic functions.

Claims

1. A method for understanding user representations based on language models, characterized in that, The method includes: Obtain a first user representation, wherein the user representation is a vector representation of the user in the given algorithm; The first user representation is input into the query transformer Q-Transformer model to generate a second user representation, wherein the second user representation includes some information from the first user representation, and the information from the first user representation is information related to the user representation description text in the first user representation. The second user representation is input into an independent linear layer, and a third user representation is generated through vector space transformation, wherein the vector representation of the third user representation is in a vector space format that can be used by large-scale language models. The third user representation and the first question information are input into the large-scale language model to generate user representation understanding text, which is natural language text that users can understand.

2. The method according to claim 1, characterized in that, The method further includes: Save the third user representation.

3. The method according to claim 1, characterized in that, The method further includes: The second problem information is input into the large-scale language model; Based on the second question information, the third user representation, and the first question information, a deep understanding text of the user representation is generated.

4. The method according to claim 1, characterized in that, The acquisition of the first user representation specifically includes: Obtain basic user information; The user's basic information is input into the user representation generator to generate the first user representation.

5. The method according to claim 1, characterized in that, The step of inputting the first user representation into the query transformer Q-Transformer model to generate the second user representation specifically includes: The first user representation is input into the linear layer of the Q-Transformer model, and an intermediate user representation is generated through vector space transformation, wherein the vector representation of the intermediate user representation is in a vector space format that can be used by the Q-Transformer model; The second user representation is generated based on the intermediate user representation and the learnable vectors of the Q-Transformer model.

6. The method according to claim 1, characterized in that, The training process of the Q-Transformer model includes: Obtain user representation samples and descriptive text samples; The parameters of the Q-Transformer model are updated based on the user representation samples and descriptive text samples.

7. The method according to claim 6, characterized in that, The step of updating the parameters of the Q-Transformer model based on the user representation samples and descriptive text samples specifically includes: The user representation samples and descriptive text samples are subjected to comparative learning tasks, matching tasks, and text generation tasks to update the parameters of the Q-Transformer model and the learnable vectors of the Q-Transformer model.

8. The method according to claim 6, characterized in that, The method further includes: The user representation samples are input into the linear layer of the Q-Transformer model through a cross-attention layer, and intermediate user representation samples are generated through vector space transformation. The vector representation of the intermediate user representation samples is in a vector space format that can be used by the Q-Transformer model. The descriptive text sample is input into the Q-Transformer model through the input layer.

9. The method according to claim 6, characterized in that, The method further includes: The descriptive text samples are generated based on a large-scale language model.

10. The method according to claim 8, characterized in that, The method further includes: The intermediate user representation samples are input into an independent linear layer, and target user representation samples are generated through vector space transformation, wherein the vector representation of the target user representation samples is in a vector space format that can be used by large-scale language models; The target user representation sample and the question information sample are input into the large-scale language model to generate user representation understanding text samples. The user representation understanding text sample is compared with the description text sample to update the parameters of the Q-Transformer model and the independent linear layer.

11. A device for understanding user representations based on a language model, characterized in that, The device includes: An acquisition unit is used to acquire a first user representation, wherein the user representation is a vector representation of the user in a given algorithm; The first generation unit is used to input the first user representation into the query transformer Q-Transformer model to generate a second user representation, wherein the second user representation includes some information from the first user representation, and the some information from the first user representation is information related to the user representation description text in the first user representation. The second generation unit is used to input the second user representation into an independent linear layer and generate a third user representation through vector space transformation, wherein the vector representation of the third user representation is in a vector space format that can be used by large-scale language models. The third generation unit is used to input the third user representation and the first question information into the large-scale language model to generate user representation understanding text, which is natural language text that users can understand.

12. An electronic device comprising a memory and a processor, characterized in that, The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in any one of claims 1-10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-10.

Citation Information

Patent Citations

  • Keyword recommendation method and device, electronic equipment and readable storage medium

    CN117951386A

  • Systems and methods for a vision-language pretraining framework

    US20240160853A1