Data processing method and apparatus, device and medium

By utilizing the masked language modeling and item comparison strategy of the pre-trained language model in the sequential recommendation model to initialize the item embedding representation, the problem of low quality of item embedding information is solved and the recommendation effect is improved.

WO2025201134A1PCT designated stage Publication Date: 2025-10-02TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Application Number
PCT/CN2025/083412
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-25
Filing Date
2025-03-19
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

In existing sequential recommendation models, the quality of item embedding information is not high, which affects the recommendation effect. This is mainly due to the huge representation difference between the textual representation of items and the historical item interaction sequence.

Method used

By utilizing the prior knowledge of the pre-trained language model, the item embedding representation is initialized through a dual-task strategy of masked language modeling and item comparison to enhance the effectiveness of the item embedding representation.

Benefits of technology

The recommendation effect of the sequence recommendation model is improved. By utilizing the prior knowledge of the pre-trained language model, the effectiveness of the item embedding representation is enhanced, and the accuracy of the recommendation model is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025083412_02102025_PF_FP_ABST
    Figure CN2025083412_02102025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are a data processing method and apparatus, a device and a medium. The method can be applied to the field of natural language processing, and is used for enhancing the effectiveness of item embedding representations. The method comprises: acquiring a first text representation of each item and a second text representation of a historical item sequence of an interactive character; performing text prediction on hidden positions in first training samples on the basis of a pre-trained language model, so as to obtain prediction probabilities of the hidden positions; performing feature analysis on the first training samples and a first positive sample on the basis of the pre-trained language model, so as to obtain a first sample similarity; training the pre-trained language model on the basis of the first sample similarity and the prediction probabilities of the hidden positions; performing feature analysis on second training samples and a second positive sample on the basis of said pre-trained language model obtained after the training, so as to obtain a second sample similarity; and on the basis of the second sample similarity, adjusting said pre-trained language model obtained after the training, so as to obtain an adjusted pre-trained language model.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing method, device, equipment and medium

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 25, 2024, with application number 202410350475.7 and application name “Data processing method, device, equipment and medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of artificial intelligence technology, and in particular to a data processing method, apparatus, device, and medium. Background Art

[0003] Sequential recommendation is an important task in recommendation systems. It models the historical item interaction sequences of each interactive role (such as the sequence of purchased items), learns the changes in the interests of each interactive role, and then predicts the next interactive item of each interactive role. In the current sequential recommendation modeling scenario, the historical item interaction sequence is used to train the sequence recommendation model. The trained sequence recommendation model can extract the feature expression of the interactive role's interests. These feature expressions can be combined with the item embedding information corresponding to each item to recommend the next interactive item of the interactive role. It can be seen that the quality of the item embedding information will directly affect the recommendation effect of the trained sequence recommendation model. The current item embedding information is usually initialized randomly or initialized by the vector obtained by vectorizing the item text representation using a network model. Due to the huge representation difference between the text representation of the item and the historical item interaction sequence, the effectiveness of the item embedding information is affected. Summary of the Invention

[0004] The embodiments of the present application provide a data processing method, apparatus, device, and medium that can fully utilize the prior knowledge in a pre-trained language model to enhance the effectiveness of object embedding representation.

[0005] On the one hand, an embodiment of the present application provides a data processing method, including:

[0006] Obtaining a first text representation of each item in the item set, obtaining a historical item sequence of the interactive character, and generating a second text representation of the historical item sequence based on the first text representation;

[0007] Generate a first training sample according to the second text representation, perform text prediction on the hidden position in the first training sample according to the pre-trained language model, and obtain a prediction probability of the hidden position;

[0008] Performing feature analysis on the first training sample and the first positive sample of the interacting character according to the pre-trained language model to obtain a first sample similarity;

[0009] Training the pre-trained language model according to the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model;

[0010] generating a second training sample according to the second text representation, and performing feature analysis on the second training sample and a second positive sample of the interacting character according to the trained pre-trained language model to obtain a second sample similarity;

[0011] The trained pre-trained language model is adjusted according to the second sample similarity to obtain an adjusted pre-trained language model, and the adjusted pre-trained language model is used to initialize the embedding representation of the item.

[0012] In one aspect, an embodiment of the present application provides a data processing device, including:

[0013] a text acquisition module, configured to acquire a first text representation of each item in the item set, acquire a historical item sequence of the interactive character, and generate a second text representation of the historical item sequence based on the first text representation;

[0014] A text prediction module is configured to generate a first training sample based on the second text representation, perform text prediction on a hidden position in the first training sample based on a pre-trained language model, and obtain a prediction probability of the hidden position;

[0015] A first item comparison module is configured to perform feature analysis on the first training sample and the first positive sample of the interacting character based on the pre-trained language model to obtain a first sample similarity;

[0016] A model pre-training module, configured to train a pre-trained language model based on the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model;

[0017] A second item comparison module is configured to generate a second training sample based on the second text representation, and perform feature analysis on the second training sample and a second positive sample of the interacting character based on the trained pre-trained language model to obtain a second sample similarity;

[0018] The model adjustment module is used to adjust the trained pre-trained language model according to the second sample similarity to obtain an adjusted pre-trained language model, and the adjusted pre-trained language model is used to initialize the embedded representation of the item.

[0019] In one aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method provided in the above aspect of the embodiment of the present application.

[0020] On one hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded and executed by a processor, so that a computer device with a processor executes the method provided in the above aspect of the embodiment of the present application.

[0021] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in the above aspect.

[0022] In an embodiment of the present application, a first text representation of each item in the item set is obtained, and the first text representations of the items contained in the historical item sequence of the interactive character are spliced ​​to obtain a second text representation of the historical item sequence; a first training sample for training a pre-trained language model and a second training sample for adjusting the trained pre-trained language model are constructed based on the second text representation. Based on the first training sample, the pre-trained language model is trained using a dual-task strategy of masked language modeling (text prediction) and item comparison to obtain a trained pre-trained language model. Based on the second training sample, the pre-trained language model is adjusted using an item comparison strategy to obtain an adjusted pre-trained language model. The above-mentioned adjusted pre-trained language model can provide an initialized item embedding representation for sequence recommendation, and can make full use of the prior knowledge of the pre-trained language model to extract sequence features in the historical item sequence, thereby enhancing the effectiveness of the item embedding representation. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] FIG1 is a schematic diagram of a network architecture provided in an embodiment of the present application;

[0024] FIG2 is a flow chart of a data processing method provided in an embodiment of the present application;

[0025] FIG3 is a schematic diagram of a text representation construction provided by an embodiment of the present application;

[0026] FIG4 is a training diagram of a pre-trained language model provided in an embodiment of the present application;

[0027] FIG5 is a schematic diagram of a process for initializing item embedding based on a pre-trained language model provided in an embodiment of the present application;

[0028] FIG6 is a schematic diagram of a training sequence recommendation task provided in an embodiment of the present application;

[0029] FIG7 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;

[0030] FIG8 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0032] The embodiments of the present application relate to text processing under natural language processing. In the sequence recommendation scenario, a text representation of an item is constructed. By text encoding the text representation of the item, an item embedding representation corresponding to each item can be obtained. The item embedding representation can be used as the initial embedding representation of the item in the sequence recommendation task, thereby enhancing the effectiveness of the item embedding representation.

[0033] Please refer to Figure 1, which is a schematic diagram of the structure of a network architecture provided in an embodiment of the present application. The network architecture may include a server 10d and a terminal cluster. The terminal cluster may include one or more terminal devices. There is no limit on the number of terminal devices included in the terminal cluster. As shown in Figure 1, the terminal cluster may specifically include terminal device 10a, terminal device 10b, and terminal device 10c, etc.; all terminal devices in the terminal cluster (for example, terminal device 10a, terminal device 10b, and terminal device 10c, etc.) can be connected to the server 10d through a network connection, so that each terminal device can exchange data with the server 10d through the network connection.

[0034] The terminal devices of the terminal cluster may include smart phones, tablet computers, laptop computers, PDAs, mobile internet devices (MIDs), wearable devices (such as smart watches, smart bracelets, etc.), smart voice interaction devices, smart home appliances (such as smart TVs, etc.), vehicle-mounted devices, aircraft and other electronic devices. This application does not limit the type of terminal devices. It can be understood that each terminal device in the terminal cluster shown in Figure 1 can install a business application, which is essentially to install the client of the business application in each terminal device. When the business application runs in each terminal device, it can interact with the server 10d shown in Figure 1 above. Among them, the client of the business application can be an independent client or an embedded sub-client (for example, a small program) integrated in a client. This application does not limit this.

[0035] Business applications may include, but are not limited to, browsers, in-vehicle applications, smart home applications, shopping applications, content interaction applications, and other applications with item recommendation capabilities. If the terminal device included in the terminal cluster is an in-vehicle device, then the in-vehicle device may be a smart terminal in a smart transportation scenario, and the business application running on the in-vehicle device may be referred to as an in-vehicle application.

[0036] Among them, server 10d can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. This application does not limit the type of server.

[0037] It is understandable that one or more business applications can be installed in each terminal device shown in Figure 1, and each business application can integrate a sequence recommendation model. The sequence recommendation model here may include but is not limited to: SASRec (Self-Attentive Sequential Recommendation, sequence recommendation based on self-attention mechanism), BERT4Rec (Sequential Recommendation with Bidirectional Encoder Representations from Transformer, sequence recommendation model based on Transformer bidirectional encoding representation), IDA-SR (Towards Universal Sequence Representation Learning for Recommender Systems, universal sequence representation learning in recommendation system), etc. This application does not limit the network structure of the sequence recommendation model. For the sequence recommendation model involved in this application, the input of the sequence recommendation model can refer to the item interaction sequence feature, which can be spliced ​​by the item embedding representations corresponding to two or more items. Among them, the item interaction sequence can refer to the item sequence generated by the interacting role in the recommendation system. The sequence obtained by splicing the item embedding representations of all items in the item interaction sequence according to the order of the items in the item interaction sequence can be called the item interaction sequence feature. An interactive role can refer to a user who provides item interaction records such as browsing, purchasing, adding favorites, and liking items during the interaction process in a recommendation system. Each interactive role in a recommendation system can have a unique role identifier, which can be associated with the interactive role's item interaction records in the recommendation system. Items involved in a recommendation system can include, but are not limited to, commodities, service-related items such as travel services, financial services, and catering services, and digital content such as media content and documents. An item embedding representation can be a representation that maps items into a continuous, low-dimensional vector space, allowing computers to better understand and process these items. For example, if the items purchased by interactive role A in the recommendation system are, in chronological order, item 1, item 2, item 3, and item 4, then the item interaction sequence for interactive role A can be represented as [item 1, item 2, item 3, item 4]. The item interaction sequence features for interactive role A can be constructed by concatenating the item embedding representations corresponding to items 1, 2, 3, and 4.

[0038] In an embodiment of the present application, a language model can be pre-trained using training sets from multiple fields to obtain a pre-trained language model. If resources permit, the pre-trained language model can be further adjusted on a training set from a specific field. The pre-trained language model that has been trained can then be used to initialize the item embedding table of the sequence recommendation model, thereby enhancing the effectiveness of the item embedding representation and improving the recommendation effect of the sequence recommendation model. The item embedding table can include item embedding representations corresponding to multiple items, and the item ID (Identity document) of each item can be used as index information for the item in the item embedding table. For example, the item ID can be used to query the item embedding representation of the items contained in the item interaction sequence of the interactive role from the item embedding table to form the item interaction sequence features input into the sequence recommendation model.

[0039] The pre-trained language model involved in the embodiments of the present application may refer to a language model trained on large-scale text data, which can be used to learn rich language knowledge and grammatical rules. The goal of the pre-trained language model is to learn language representation on unlabeled text data so that it has good generalization ability and can be applied to various natural language processing tasks. The pre-trained language model generally includes two steps: ① Pre-training stage (Pretraining), in which the model can learn knowledge such as the grammatical structure, semantic information and contextual association of the text. ② Fine-tuning stage (Fine-tuning), fine-tuning on specific downstream tasks (for example, text type, language understanding, etc.) to adapt to the needs of specific tasks and improve the performance of the model on the task. Among them, the pre-trained language model may include but is not limited to: BERT (Bidirectional Encoder Representations from Transformers, based on Transformer's bidirectional encoding representation), GPT (Generative Pretrained Transformer, generative pre-trained Transformer), RoBERTa (Robustly optimized BERT approach, optimized BERT pre-training method), Longformer (The Long-Document Transformer, based on long text Transformer), etc. This application does not limit the network structure of the pre-trained language model. The pre-trained language model in the embodiment of the present application belongs to a pre-trained model, which can also be called a language model, or can be called a large language model, and this application does not limit this.

[0040] Please refer to Figure 2, which is a flow chart of a data processing method provided in an embodiment of the present application. It is understandable that the data processing method can be executed by a computer device, which can be a server (server 10d as shown in Figure 1) or a terminal device (any terminal device in the terminal cluster as shown in Figure 1), and this application does not limit this. As shown in Figure 2, the data processing method can include the following steps S101 to S106:

[0041] Step S101 : obtaining a first text representation of each item in an item set, obtaining a historical item sequence of an interactive character, and obtaining a second text representation of the historical item sequence based on the first text representation.

[0042] In an embodiment of the present application, a business application with an integrated sequence recommendation function can be run in a computer device to obtain items in the business application and add the items in the business application to an item collection. In addition, all registered interactive roles in the business application can be obtained and the registered interactive roles in the business application can be added to the interactive role collection. Then, based on the item interaction records of each interactive role in the interactive role collection in the business platform, the item interaction sequence of each interactive role in the interactive role collection can be obtained. Among them, the registered interactive role can refer to a user who has completed the registration process in the business application system or related services and can be recognized and recorded by the business application system. For example, each user can be assigned a unique identifier for identifying the user's identity. The user can use this identifier to log in to the business application and experience the personalized services and functions provided by the business application. The above-mentioned item interaction records can refer to the item purchase records, item sharing records, item collection records, etc. of each interactive role in the business platform, and this application does not limit this. The items included in the item interaction sequence can be sorted according to the item interaction time (for example, purchase time, sharing time, collection time, etc.). The items in the item interaction sequence are all historical interaction items of the interactive role. For ease of understanding, the embodiment of the present application can refer to the item interaction sequence of each interactive role as a historical item sequence; each interactive role in the interactive role set can correspond to a historical item sequence. When an interactive role in the interactive role set is a newly registered interactive role in the business application, the historical item sequence of the interactive role can be an empty value. The following description takes any interactive role in the interactive role set as an example.

[0043] After obtaining the item set, interactive role set, and historical item sequences for each interactive role pair in the interactive role set from the business platform, a textual representation can be constructed for all items in the item set and the historical item sequences corresponding to each interactive role in the interactive role set. The process of constructing the item textual representation may include, but is not limited to, obtaining the item type (Category), item identifier (Brand), and item name (Title) corresponding to each item in the item set, combining the item type, item identifier, and item name corresponding to the same item to obtain a textual representation for each item. This textual representation may be referred to as the first textual representation. The item type refers to the result of classifying an item based on its attributes (e.g., color, size, shape, etc.), function, use, or other characteristics. For example, items can be classified by material, use, and other characteristics to obtain the item type corresponding to each item. Item types may include, but are not limited to, clothing, electronics, beauty products, pharmaceuticals, personal care and cleaning, office supplies, beverages, etc. The item identifier may refer to the brand of the item and can be used to distinguish a product from other similar products in the market through trademarks, logos, names, designs, and other features. The name of an item may refer to a name (or title) used to uniquely identify or distinguish an item. The name of an item may generally be composed of at least one of the following factors: manufacturer, product type, brand, model, specification, etc.

[0044] For each interactive role in the interactive role set, the historical item sequence corresponding to each interactive role can be sorted in descending order based on their interaction times to obtain a sorted historical item sequence. The first text representations corresponding to the items in the sorted historical item sequence can then be concatenated to obtain a second text representation corresponding to each interactive role's historical item sequence. In other words, the first text representations of the items in each interactive role's historical item sequence can be concatenated in reverse order to form a second text representation corresponding to each interactive role's historical item sequence. One second text representation can be constructed for each historical item sequence. Descending order can refer to sorting the interval between the item's interaction time and the current time in ascending order. The items in the historical item sequence can be sorted in order of earliest to latest interaction time. The second text representation of the historical item sequence can be the result of concatenating the first text representations of each item in order of latest to earliest interaction time. This concatenation method can be referred to as reverse order concatenation.

[0045] Please refer to Figure 3, which is a schematic diagram of a text representation construction provided by an embodiment of the present application. As shown in Figure 3, assume that the item interaction records of interactive role A in the business platform are as follows: the interaction time of item 1 is t1; the interaction time of item 2 is t2; and the interaction time of item 3 is t3. If t1 is earlier than t2, and t2 is earlier than t3, then the historical item sequence of interactive role A can be represented as [item 1, item 2, item 3]. Among them, the first text representation 20a corresponding to item 1 can be represented as "(Type: Electronic Product) XX Mobile Phone 16GB Memory 8-Core Processor (Brand: XX)"; the first text representation 20b corresponding to item 2 can be represented as "(Type: Electronic Product) XX Laptop i7 (Brand: XX)"; and the first text representation 20c corresponding to item 3 can be represented as "(Type: Electronic Product) Mouse (Brand: XX)". Then, the second text representation corresponding to the historical item sequence of interactive role A can be the first text representation 20c corresponding to item 3, the first text representation 20b corresponding to item 2, and the first text representation 20a corresponding to item 1, which are sequentially spliced ​​together.

[0046] Step S102 : generating a first training sample according to the second text representation, performing text prediction on the hidden position in the first training sample according to the pre-trained language model, and obtaining a prediction probability of the hidden position.

[0047] Specifically, the first training sample for training the pre-trained language model can be generated through the second text representation corresponding to the historical item sequence of each interactive role. The first training sample here can refer to the input text representation for input into the pre-trained language model; in the pre-training stage of the pre-trained language model, the pre-trained language model can be trained based on the first training sample using a dual-task strategy of masked language modeling task and item-item comparison task (which can be simply referred to as item comparison). Among them, the masked language modeling task can refer to predicting randomly hidden words or phrases based on the non-hidden text part in the input text representation; in an embodiment of the present application, the input text representation can be the first training sample, and the position of the randomly hidden words or phrases in the first training sample can be called the hidden position. The item-item comparison task can refer to learning the feature representation of different items using a pre-trained language model, and calculating the similarity between different items through the output layer of the pre-trained language model.

[0048] The construction process of the first training sample may include but is not limited to: determining the hidden position in the second text representation based on the text selection ratio, determining the text representation of the hidden position as the candidate text representation; performing a hiding process on the candidate text representation to obtain a hidden text representation, replacing the candidate text representation in the second text representation with the hidden text representation to obtain an initial sample, adding a marker text to the initial sample (for example, a [CLS] word, the [CLS] word can be added at the first position of the initial sample), and obtaining a first training sample. Among them, the hiding process of the candidate text representation may refer to the process of hiding the candidate text representation in the second text representation using a first hiding probability and a second hiding probability. The first hiding probability refers to the probability of replacing the candidate text representation in the second text representation with a mask (for example, a [MASK] word), and the second hiding probability refers to the probability of replacing the candidate text representation in the second text representation with a random text representation. For example, the text selection ratio in the embodiment of the present application can be set to 15%, the first hiding probability can be set to 80%, the second hiding probability can be set to 10%, etc. The embodiment of the present application can be set according to the specific requirements of the actual application scenario, and the specific settings of the above-mentioned text selection ratio, first hiding probability, and second selection probability are not limited.

[0049] The aforementioned text selection ratio may refer to the pre-set hidden text selection ratio for the masked language modeling task of the pre-trained language model. For example, if the text length corresponding to the input text of the pre-trained language model (e.g., the second text representation) is C (C is an integer greater than 1) and the pre-set text selection ratio is p (p is any number greater than 0 and less than 1), then the total length of text that needs to be hidden in the masked language modeling task can be determined to be C×p. A hidden position may refer to the position of a text representation selected for hiding in the second text representation, or the position of a word or phrase selected for hiding. A candidate text representation may refer to all text representations selected for hiding in the second text representation; that is, a candidate text representation may refer to the original text representation of a hidden position in the second text representation. A hidden text representation may refer to the result of hiding a candidate text representation in the second text representation. For example, the hidden text representation may be obtained by replacing the candidate text representation in the second text representation with a mask, random text, or the like. An initial sample may refer to the second text representation after hiding the candidate text representation. The first training sample refers to the second text representation after the [CLS] word is added to the first position and the candidate text representation is hidden; the hidden position in the first training sample can be considered as the position in the first training sample that has completed the hidden processing and needs to be used for text prediction during the model training process.

[0050] In a feasible embodiment, the length of the text can be represented by the number of tokens (words or word examples) contained in the text representation (for example, the second text representation). In natural language processing, a token can be understood as the smallest unit with independent meaning in the text, usually referring to a word, number, phrase, or other part with independent meaning. For example, when the length of the text that needs to be hidden in the masked language modeling task is C×p, it means that C×p tokens in the second text processing need to be hidden; therefore, the position of the token that needs to be hidden can be determined in the second text representation, that is, the hidden position in the second text representation is determined; the hidden position at this time can refer to the position of a single token, for example, the position of each token in the second text representation can be used as a hidden position. The above C×p tokens that need to be hidden can be randomly selected from the second text representation, and the selected C×p tokens can be called candidate text representations.

[0051] For example, let's assume that the text selection ratio is 15%, the first hiding probability is 80%, and the second hiding probability is 10%. The masked language modeling task in the pre-trained language model can randomly select 15% of the tokens in the second text representation and hide these selected tokens in the following manner: ① Replace the selected tokens with masks ([MASK] tokens) with the first hiding probability (80%); ② Replace the selected tokens with random tokens with the second hiding probability (10%); ③ Leave the selected tokens unchanged with the third hiding probability (10%). The original values ​​of the selected tokens are predicted by the pre-trained language model to obtain the predicted probabilities corresponding to each selected token in the masked language modeling task.

[0052] In a feasible embodiment, the text length can be expressed by the number of items contained in the text representation (for example, the second text representation), or can be understood as being expressed by the number of first text representations contained in the second text representation; it should be understood that the first text representation corresponding to each item may include one or more tokens. For example, when the length of the text that needs to be hidden in the masked language modeling task is C×p, it means that C×p first text representations in the second text processing need to be hidden; therefore, the position of the first text representation that needs to be hidden can be determined in the second text representation, such as determining the hidden position in the second text representation; the hidden position at this time can refer to the position of the entire first text representation that needs to be hidden, that is, one hidden position corresponds to the entire first text representation in the second text representation. The above-mentioned C×p first text representations that need to be hidden can be randomly selected from the second text representation, and the selected C×p first text representations can be called candidate text representations.

[0053] For example, let's assume that the text selection ratio is 15%, the first hiding probability is 80%, and the second hiding probability is 10%. The masked language modeling task in the pre-trained language model can randomly select 15% of the first text representations in the second text representation and hide these selected first text representations in the following manner: ① Replace the selected first text representation with a mask ([MASK] word) at the first hiding probability (80%); ② Replace the selected first text representation with a random first text representation at the second hiding rate (10%); ③ Leave the selected first text representation unchanged at the third hiding probability (10%). The pre-trained language model is used to predict the original value of the selected first text representation to obtain the predicted probability corresponding to each selected first text representation in the masked language modeling task.

[0054] In summary, in the embodiments of the present application, the masked language modeling task in the pre-trained language model can hide a single token in the second text representation, or hide the entire first text representation in the second text representation, and the present application does not limit this.

[0055] It should be noted that before the text representation corresponding to the item or historical item sequence (for example, the first text representation, or the second text representation) is input into the pre-trained language model, a special marker text (for example, [CLS] word) can be added before the text representation. The output of the marker text in the last layer of the pre-trained language model can be used as the embedding representation of the item or historical item sequence for subsequent model training and item embedding initialization. Adding the marker text is conducive to the model learning the bidirectional semantic knowledge in the historical item sequence. For example, suppose the second text representation corresponding to a historical item sequence is X1 = {T1, T2...Tn}, then the second text corresponding to the historical item sequence needs to be added with a marker text before inputting into the pre-trained language model, i.e. X2 = {[CLS], T1, T2...T n}; where X1 represents the second text representation corresponding to a historical item sequence, T1, T2...T n The first, second, ..., nth first text representation in the second text representation is represented by X1. The text representation after adding the mark text ([CLS] word) to the second text representation X1 is recorded as X2. Where X1 = {T1, T2...T n} and X2={[CLS],T1,T2...T n}, the interaction time of the item corresponding to T1 is later than the interaction time of the item corresponding to T2, the interaction time of the item corresponding to T2 is later than the interaction time of the item corresponding to T3, and so on. n The corresponding item has the earliest interaction time in the entire sequence; in other words, X1 and X2 are sorted in reverse order from latest to earliest interaction time.

[0056] In a feasible embodiment, the text prediction of the first training sample can be performed by a pre-trained language model to obtain the prediction probability corresponding to the hidden position in the first training sample. Optionally, if the pre-trained language model is any language model with an encoder architecture, the first training sample can be input into the encoder in the pre-trained language model, and the first training sample is encoded by the encoder to obtain the first sample embedding representation corresponding to the first training sample; the first sample embedding representation can be used to predict the prediction probability of each hidden position in the first training sample. The prediction probability here can refer to the probability of predicting the selected candidate text representation (token or first text representation) based on the text representation of the first training sample other than the hidden position in the masked language modeling task of the pre-trained language model. Among them, the encoder can be used to learn the semantic association between the first text representations other than the hidden position in the first training sample to obtain the first sample embedding representation corresponding to the first training sample. The encoder can be used to perform bidirectional encoding on the first training sample, which can improve the effectiveness of the first sample embedding representation.

[0057] Step S103 : performing feature analysis on the first training sample and the first positive sample of the interacting role according to the pre-trained language model to obtain a first sample similarity.

[0058] Specifically, in the pre-training stage of the pre-trained language model, the item-item comparison task can use the first text representation of the next real interactive item of the same interactive role in the sequence recommendation as a positive sample, and use the first text representation of other items in the same batch except the next real interactive item of the same interactive role as a negative sample. It can be understood that the embodiment of the present application involves a large-scale first training sample. In order to improve the training efficiency of the pre-trained language model, the large-scale first training sample can be batch trained. For example, the large-scale first training sample can be divided into multiple batches, and each training can input a batch of first training samples to train the network parameters of the pre-trained language model. Real interactive items can refer to items that the interactive roles actually interact with in actual situations.

[0059] A first training sample can be either a positive sample or a negative sample; that is, all first training samples used in the pre-training phase can include both positive and negative samples, and the positive and negative samples here can be considered to be relative to the same interactive role. For example, in an item-to-item comparison task, for any interactive role in the interactive role set, such as interactive role A, the first textual representation of the subsequent interactive item of interactive role A can be determined as the first positive sample of the first training sample currently being processed; the subsequent interactive item here can refer to the next real interactive item based on the historical item sequence of interactive role A in sequential recommendation. For example, if the historical item sequence of interactive role A is represented as [item 1, item 2, item 3], and the next real interactive item of interactive role A in sequential recommendation is item 4, then item 4 can be considered as the next real interactive item of interactive role A.

[0060] Assuming that the first training sample being processed is generated by the second text representation corresponding to the historical item sequence of interactive character A, and the first positive sample is the next real interactive item in the historical item sequence of interactive character A, then the first training sample being processed at this time can be called a positive sample in the pre-training stage. Assuming that the first training sample being processed is generated by the second text representation corresponding to the historical item sequence of interactive character A, and the first positive sample is not the next real interactive item in the historical item sequence of interactive character A, then the first training sample being processed at this time can be called a negative sample in the pre-training stage. Assuming that the first training sample being processed is generated by the second text representation corresponding to the historical item sequence of the remaining interactive characters A, then the first training sample being processed at this time can be called a negative sample in the pre-training stage, and the remaining interactive characters here can refer to any interactive character in the interactive character set except interactive character A. The first training sample and the first positive sample can belong to the same interactive character or to different interactive characters, and this application does not limit this.

[0061] Feature analysis may refer to a process of calculating the feature representation of a first training sample (which may be referred to as a first sample embedding representation) and a feature representation of a first positive sample (which may be referred to as a second sample embedding representation) through a pre-trained language model, and calculating the similarity between the first training sample and the first positive sample through the first sample embedding representation and the second sample embedding representation. For example, the first positive sample may be input into a pre-trained language model, and the first positive sample may be encoded by an encoder in the pre-trained language model to obtain a second sample embedding representation corresponding to the first positive sample; the role embedding representation of the interactive role may be obtained, and the first sample similarity may be obtained based on the role embedding representation, the second sample embedding representation, and the first sample embedding representation of the first training sample. The role embedding representation may refer to a representation method of mapping relevant information of the interactive role (e.g., basic personal information, types of items of interest, browsing history, collection history, etc.) into a continuous, low-dimensional vector space so that the computer device can better understand and process the relevant information of the interactive role; the role embedding representation may be obtained through a pre-trained language model, or may be obtained through other networks, and this application does not limit this.

[0062] Wherein, assuming that the number of first training samples is M, M is a positive integer; then according to the role embedding representation, the second sample embedding representation, and the first sample embedding representation corresponding to the first training sample, the first sample similarity is obtained, which may include but is not limited to: obtaining the first feature similarity between the role embedding representation and the second sample embedding representation, performing an exponential operation on the first feature similarity, and obtaining a first candidate similarity value; obtaining the second feature similarity between the role embedding representation and the first sample embedding representation corresponding to each first training sample, performing an exponential operation on the second feature similarity, and obtaining a second candidate similarity value corresponding to each first training sample; accumulating the second candidate similarity values ​​corresponding to each first training sample to obtain a cumulative similarity value, and determining the first sample similarity according to the ratio between the first candidate similarity value and the cumulative similarity value; the first sample similarity can be used as the loss of the item-item comparison task in the pre-trained language model. Wherein, the calculation method of the first sample similarity can be shown as the following formula (1):

[0063] Where L1 represents the first sample similarity between the i-th first training sample and the first positive sample, i is a positive integer less than or equal to M, log represents the logarithmic function with base 10, and h s represents the role embedding representation calculated by the pre-trained language model. Here, the role embedding representation may refer to the embedding representation corresponding to the interacting role associated with the first positive sample; represents the second sample embedding representation of the first positive sample (the first positive sample corresponding to the i-th first training sample) calculated by the pre-trained language model; i represents the first sample embedding representation of the i-th first training sample calculated by the pre-trained language model. B can be expressed as the batch size, and τ is a hyperparameter; represents the cosine similarity (first feature similarity) between the role embedding representation and the second sample embedding representation; sim(h s ,h i ) represents the cosine similarity (second feature similarity) between the role embedding representation and the first sample embedding representation.

[0064] Step S104: training the pre-trained language model according to the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model.

[0065] Specifically, assume that the number of hidden positions in the first training sample is N, where N is a positive integer. For example, the number of selected text representations in the first training sample is N, or the number of selected tokens in the first training sample is N. Perform a logarithmic operation on the predicted probabilities corresponding to the N hidden positions to obtain the logarithmic values ​​of the probabilities corresponding to each hidden position. Accumulate the logarithmic values ​​of the probabilities corresponding to each hidden position to determine the masked language modeling loss. The calculation method of the masked language modeling loss can be shown in the following formula (2):

[0066] Wherein, L2 in formula (2) represents the masked language modeling loss, X represents the first training sample input to the pre-trained language model, and m(X) represents the set of all text representations that have been hidden in the first training sample, or can be understood as the set of text representations selected in the second text representation; represents any hidden text representation in the first training sample; X \m(x) represents the text representation without hidden processing in the first training sample, that is, the remaining text representation in the first training sample except m(X); It represents the probability that the pre-trained language model predicts the hidden text representation (the selected token or the selected first text representation, etc.) in the first training sample, that is, the predicted probability corresponding to the hidden position.

[0067] Furthermore, the model training loss corresponding to the pre-trained language model can be determined based on the masked language modeling loss and the first sample similarity. The model training loss can be calculated as shown in the following formula (3): L PT =L1+γL2 (3)

[0068] Among them, L in formula (3) PT It can be expressed as the model loss of the pre-trained language model in the pre-training stage. γ is a hyperparameter that can be used to control the weight of the masked language modeling task.

[0069] During the pre-training phase of the pre-trained language model, the network parameters of the pre-trained language model can be iteratively trained according to the model training loss until the model training loss meets the training end condition, and the training is stopped to obtain the pre-trained language model after training. The training end condition here can be that the number of training times of the pre-trained language model reaches the maximum number of iterations, or that the model training loss reaches the convergence condition. This application does not limit the setting of the training end condition. When the pre-trained language model reaches the training end condition, the pre-training of the pre-trained language model can be stopped, and the network parameters at the time of training stop can be saved, and the network parameters saved here can be used as the pre-trained language model after training.

[0070] Step S105 : generating a second training sample according to the second text representation, and performing feature analysis on the second training sample and the second positive sample of the interacting role according to the trained pre-trained language model to obtain a second sample similarity.

[0071] In one feasible implementation, if resources permit, the pre-trained language model can be further adjusted in the target domain to further improve its performance. During the fine-tuning phase of the pre-trained language model, the item-item comparison task can still be used to adjust the pre-trained language model. The training samples in the fine-tuning phase of the pre-trained language model can be referred to as second training samples. The second training samples can also be generated based on the second text representation corresponding to the historical item sequence. The second training samples do not need to be hidden, and the second training samples are all negative samples, that is, all second training samples are negative samples.

[0072] Among them, the first training sample and the second training sample can be selected according to attributes. The first training sample can refer to a text representation with generalized attributes, and the second training sample can refer to a text representation with personalized attributes. In this way, both text representations with generalized attributes and text representations with personalized attributes can be obtained, which enhances the embedded representation of the pre-trained language model in the personalized field while ensuring the generalization performance of the pre-trained language model.

[0073] The construction process of the second training sample may include but is not limited to: adding a marker text (for example, [CLS] word) to the second text representation to obtain the second training sample, and determining the second positive sample of the interactive role. It can be understood that for the same interactive role, the first positive sample and the second positive sample can be the first text representation of the same item; for different interactive roles, the first positive sample and the second positive sample can be the first text representation of different items, or the first text representation of the same item. The first positive sample and the second positive sample are both relative to the interactive role, and this application does not limit this. By encoding the second training sample with a pre-trained language model, a third sample embedding representation of the second training sample can be obtained, and by encoding the second positive sample with a pre-trained language model, a fourth sample embedding representation of the second positive sample can be obtained; according to the third sample embedding representation, the fourth sample embedding representation, and the role embedding representation of the interactive role, the second sample similarity can be obtained. Among them, the second training sample used in the fine-tuning stage of the pre-trained language model can be a full negative sample. After determining a second positive sample in this stage, a second training sample for adjusting the pre-trained language model can be determined in the item set. For example, assuming that the second positive sample is the first text representation of an item in the historical item sequence of interactive character B (for ease of understanding, it can be called a candidate item), then the second training sample can be the first text representation of other items in the item set except the candidate item and the item before the candidate item in the historical item sequence of interactive character B. The calculation method of the second sample similarity can refer to the calculation method of the first sample similarity mentioned above, and will not be repeated here; the calculation method of the second sample similarity can be shown as the following formula (4):

[0074] Among them, L FT represents the second sample similarity between the second training sample and the second positive sample, that is, the item comparison task loss of the pre-trained language model in the fine-tuning stage after training. Log represents the logarithmic function with base 10. h in formula (4) s represents the role embedding representation calculated by the pre-trained language model after training. Here, the role embedding representation may refer to the embedding representation corresponding to the interactive role associated with the second positive sample; I represents the fourth sample embedding representation of the second positive sample calculated by the trained pre-trained language model; i represents the third sample embedding representation of the second training sample calculated by the trained pre-trained language model. I can be expressed as the batch size, and τ is a hyperparameter; represents the cosine similarity between the role embedding representation and the fourth sample embedding representation; sim(h s ,I i) represents the cosine similarity between the role embedding representation and the third sample embedding representation.

[0075] Step S106: Adjust the trained pre-trained language model according to the second sample similarity to obtain an adjusted pre-trained language model.

[0076] Specifically, in the fine-tuning stage of the 2 pre-trained language model, the network parameters of the trained pre-trained language model can be iteratively trained according to the second sample similarity until the second sample similarity meets the training end condition, and the training is stopped to obtain the adjusted pre-trained language model. Among them, the training end condition here can be that the number of training times of the trained pre-trained language model reaches the maximum number of iterations, or it can be that the second sample similarity reaches the convergence condition. This application does not limit the setting of the training end condition. When the trained pre-trained language model reaches the training end condition, the fine-tuning of the trained pre-trained language model can be stopped, and the network parameters at the time of training stop can be saved. The network parameters saved here are used as the adjusted pre-trained language model, and the adjusted pre-trained language model can be used to initialize the embedding representation of the object.

[0077] Please refer to Figure 4, which is a training diagram of a pre-trained language model provided in an embodiment of the present application. As shown in Figure 4, the training process of the pre-trained language model can include two stages, respectively denoted as a pre-training stage and a fine-tuning stage. In the pre-training stage of the pre-trained language model, the pre-trained language model can be pre-trained using the strategies of the latent language modeling task and the item-item comparison task to obtain a trained pre-trained language model. In the fine-tuning stage of the pre-trained language model, the pre-trained language model can be adjusted using the strategy of the item-item comparison task to obtain an adjusted pre-trained language model.

[0078] In an embodiment of the present application, a first text representation corresponding to each item in the item set is obtained, and the first text representations corresponding to the items contained in the historical item sequence of each interactive character are spliced ​​to obtain a second text representation corresponding to the historical item sequence; a first training sample for training a pre-trained language model and a second training sample for adjusting the trained pre-trained language model are constructed based on the second text representation. Based on the first training sample, the pre-trained language model is trained using a dual-task strategy of masked language modeling (text prediction) and item comparison to obtain a trained pre-trained language model. Based on the second training sample, the pre-trained language model is adjusted using an item comparison strategy to obtain an adjusted pre-trained language model. The above-mentioned adjusted pre-trained language model can provide an initialized item embedding representation for sequence recommendation, and can make full use of the prior knowledge of the pre-trained language model to extract sequence features in the historical item sequence, thereby enhancing the effectiveness of the item embedding representation.

[0079] In an embodiment of the present application, the adjusted pre-trained language model can be used to initialize item embeddings for a general sequence recommendation model. See Figure 5 below, which is a flow chart of item embedding initialization based on a pre-trained language model provided in an embodiment of the present application. It can be understood that the embodiment corresponding to Figure 5 is the application of the adjusted pre-trained language model. As shown in Figure 5, the data processing method may include the following steps S201 to S205:

[0080] Step S201 : adding a marker text to the first text representation corresponding to each item in the item set to obtain an item input text corresponding to each item in the item set.

[0081] In the embodiment of the present application, a marker text (eg, [CLS] word) may be added to the first text representation corresponding to each item in the item set, and the item input text corresponding to each item in the item set may be obtained.

[0082] In step S202 , the item input texts corresponding to the respective items are input into the adjusted pre-trained language model, and the item embedding representations corresponding to the respective items are obtained through the adjusted pre-trained language model.

[0083] Specifically, for each item in the item set, an item input text can be obtained. This item input text can be input into the adjusted pre-trained language model, which then outputs the corresponding output of the marker text (e.g., [CLS] word) as the item embedding representation of the item pair. In the same way, the item embedding representation corresponding to each item in the item set can be obtained.

[0084] Step S203: Add the item embedding representation corresponding to each item to the item embedding table.

[0085] Specifically, each time an item embedding representation corresponding to an item in an item set is calculated, the item embedding representation of the item can be added to the item embedding table to initialize the item embedding table; the item embedding table can be used as the initialization sequence feature in sequential recommendation modeling.

[0086] Step S204: Generate a third training sample for the sequence recommendation model based on the item embedding representation in the item embedding table and the historical item sequence corresponding to the interactive role.

[0087] Step S205: Train the sequence recommendation model according to the third training sample to obtain a trained sequence recommendation model.

[0088] Among them, the training of the sequence recommendation model includes the first stage and the second stage. The first stage is used to train the sequence modeling task and suspend the training of the item embedding representation; the second stage is used to train the item embedding representation and suspend the training of the sequence modeling task; the trained sequence recommendation model is used for item recommendation.

[0089] After initializing the item embedding table, a two-stage training strategy can be used to train the sequential recommendation model. In the first stage, the item embedding representations in the sequential recommendation model can be frozen, and only the sequence modeling portion of the model can be trained. In the second stage, the sequence modeling portion of the model can be frozen, and only the item embedding representations in the model can be trained. During the training process of the sequential recommendation model, all other training settings are consistent with the original general settings of the sequential recommendation model.

[0090] It is understandable that using the adjusted pre-trained language model to initialize the item embedding table in the sequence recommendation model, and using a two-stage training strategy to train the sequence recommendation model based on the initialized item embedding table is only an example provided by this application. This application can also use other strategies to train the sequence recommendation model and perform two-stage model training on the sequence recommendation model. For example, after completing the initialization of the item embedding table, the full parameters of the model can be directly trained on the data set of the target domain. Alternatively, the item representation obtained by encoding based on the adjusted pre-trained language model can be used as an additional feature of each item and frozen, and added to the original item embedding representation during training and inference. The full parameters in the sequence modeling model are trained on the data set of the target domain, etc. This application does not limit the training strategy of the sequence recommendation model.

[0091] Please refer to Figure 6, which is a training diagram of a sequence recommendation task provided by an embodiment of the present application. As shown in Figure 6, a first text representation can be constructed for each item in the item set, and a second text representation corresponding to the historical item sequence of each interactive role in the interactive role set can be constructed based on the first text representation of each item. A first training sample and a second training sample are constructed based on the second text representation, and the pre-trained language model is pre-trained using the first training sample to obtain a trained pre-trained language model; the trained pre-trained language model is adjusted based on the second training sample to obtain an adjusted pre-trained language model. The item embedding table can be initialized through the adjusted pre-trained language model. Based on the initialized item embedding table, the initialization sequence features of the sequence recommendation model can be constructed, and based on the initialization sequence features, the sequence recommendation model is trained in two stages to obtain a trained sequence recommendation model. The trained sequence recommendation model can be iteratively trained according to the interactive role representation output by the model; the trained sequence recommendation model can be used for item recommendation.

[0092] Please refer to Tables 1 and 2 below, which show the test results of a sequence recommendation model that uses the adjusted pre-trained language model to initialize the item embedding table, and some other sequence recommendation models tested on different datasets (i.e., using text representations in different datasets for item recommendation). Among them, other sequence recommendation models involved in the embodiments of the present application may include but are not limited to: SASRec, UniSRec (Towards Universal Sequence Representation Learning for Recommender Systems, a universal sequence representation learning model enhanced by a pre-trained language model), RECFORMER (a universal sequence representation learning model enhanced by a pre-trained language model), etc.

[0093] Table 1

[0094] Table 2

[0095] Among them, this solution refers to the sequence recommendation model provided by this application that uses the adjusted pre-trained language model to initialize the item embedding table. HR (Hit Radio) is used to evaluate the accuracy of the model's prediction of recommended items. The higher the HR@1 and HR@5 indicators, the higher the accuracy of the model's recommended items. NDCG (Normalized Discounted Cumulative Gain) is used to evaluate the rationality of the recommendation order when the model recommends items. The higher the NDCG@5 indicator, the more the model can prioritize recommending items that are in line with the interactive character's own interests.

[0096] From the results in Tables 1 and 2 above, it can be seen that the performance of this scheme is better than UniSRec and RECFORMER in almost all data sets. At the same time, after using the pre-trained language model proposed in this application to initialize the item embedding table, the performance of SASRec and BERT4Rec in the sequence recommendation task has been greatly improved. The above experimental results fully demonstrate the effectiveness of this scheme.

[0097] The embodiment of the present application initializes the item embedding representation through the adjusted pre-trained language model, so that the text information and sequence features can be better aligned. While fully utilizing the prior knowledge of the pre-trained language model, the historical item interaction sequence features are accurately extracted, thereby enhancing the effectiveness of the item embedding representation and further improving the recommendation effect of the sequence recommendation model.

[0098] It is understandable that in the specific implementation of this application, interactive information such as the user's item purchase records in the shopping platform may be involved. When the above embodiments of this application are applied to specific products or technologies, it is necessary to obtain permission or consent from relevant institutions or departments, or the users themselves, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards in the relevant regions.

[0099] Please refer to Figure 7, which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in Figure 7, the data processing device 1 includes: a text acquisition module 101, a text prediction module 102, a first item comparison module 103, a model pre-training module 104, a second item comparison module 105, and a model adjustment module 106;

[0100] A text acquisition module 101 is configured to acquire a first text representation of each item in the item set, acquire a historical item sequence of the interactive character, and generate a second text representation of the historical item sequence based on the first text representation;

[0101] A text prediction module 102 is configured to generate a first training sample based on the second text representation, and perform text prediction on the hidden position in the first training sample based on the pre-trained language model to obtain a prediction probability of the hidden position;

[0102] A first object comparison module 103 is configured to perform feature analysis on the first training sample and the first positive sample of the interactive character based on the pre-trained language model to obtain a first sample similarity;

[0103] A model pre-training module 104 is configured to train a pre-trained language model based on the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model;

[0104] A second object comparison module 105 is configured to generate a second training sample based on the second text representation, and perform feature analysis on the second training sample and a second positive sample of the interacting character based on the trained pre-trained language model to obtain a second sample similarity;

[0105] The model adjustment module 106 is used to adjust the trained pre-trained language model according to the second sample similarity to obtain an adjusted pre-trained language model, and the adjusted pre-trained language model is used to initialize the embedded representation of the item.

[0106] In one or more embodiments, the text acquisition module 101 acquires a first text representation of each item in the item set, acquires a historical item sequence of the interactive character, and generates a second text representation of the historical item sequence based on the first text representation, for performing the following steps:

[0107] Obtaining the item type, item identifier, and item name of each item in the item set, and combining the item type, item identifier, and item name of the same item to obtain first text representations corresponding to each item;

[0108] Obtain the historical item sequence of the interactive character, and sort the items in the historical item sequence in descending order according to the interaction time corresponding to the items in the historical item sequence to obtain a sorted historical item sequence;

[0109] The first text representations of the items included in the sorted historical item sequence are concatenated to obtain a second text representation of the historical item sequence of the interactive character.

[0110] In one or more embodiments, the text prediction module 102 generates a first training sample according to the second text representation, for performing the following steps:

[0111] determining a hidden position in the second text representation according to the text selection ratio, and determining the text representation of the hidden position as a candidate text representation;

[0112] The candidate text representation is hidden to obtain a hidden text representation, the candidate text representation in the second text representation is replaced with the hidden text representation to obtain an initial sample, and a marker text is added to the initial sample to obtain a first training sample.

[0113] In one or more embodiments, the text prediction module 102 performs a hidden process on the candidate text representation in the second text representation to obtain a hidden text representation for performing the following steps:

[0114] Using the first hiding probability and the second hiding probability, the candidate text representation is hidden to obtain a hidden text representation;

[0115] The first hiding probability refers to the probability of replacing the candidate text representation with the mask, and the second hiding probability refers to the probability of replacing the candidate text representation with the random text representation.

[0116] In one or more embodiments, the text prediction module 102 performs text prediction on the hidden position in the first training sample based on the pre-trained language model to obtain a prediction probability of the hidden position, which is used to perform the following steps:

[0117] Inputting the first training sample into the pre-trained language model, encoding the first training sample through the pre-trained language model to obtain a first sample embedding representation corresponding to the first training sample;

[0118] Perform text prediction on the hidden position in the first training sample according to the first sample embedding representation to obtain a prediction probability of the hidden position.

[0119] In one or more embodiments, the first item comparison module 103 performs feature analysis on the first training sample and the first positive sample of the interacting character based on the pre-trained language model to obtain a first sample similarity for performing the following steps:

[0120] Determining a subsequent interactive item of the interactive role, and determining a first text representation of the subsequent interactive item as a first positive sample of the interactive role;

[0121] Inputting the first positive sample into the pre-trained language model, encoding the first positive sample through the encoder in the pre-trained language model to obtain a second sample embedding representation corresponding to the first positive sample;

[0122] Obtain a role embedding representation of the candidate interactive role, and obtain a first sample similarity based on the role embedding representation, the second sample embedding representation, and the first sample embedding representation corresponding to the first training sample.

[0123] In one or more embodiments, the number of first training samples is M, where M is a positive integer;

[0124] The first item comparison module 103 obtains a first sample similarity based on the role embedding representation, the second sample embedding representation, and the first sample embedding representation corresponding to the first training sample, and is used to perform the following steps:

[0125] Obtaining a first feature similarity between the role embedding representation and the second sample embedding representation, performing an exponential operation on the first feature similarity to obtain a first candidate similarity value;

[0126] Obtaining a second feature similarity between the role embedding representation and the first sample embedding representation corresponding to each first training sample, performing an exponential operation on the second feature similarity to obtain a second candidate similarity value corresponding to each first training sample;

[0127] The second candidate similarity values ​​corresponding to the first training samples are accumulated to obtain a cumulative similarity value, and the first sample similarity is determined according to a ratio between the first candidate similarity value and the cumulative similarity value.

[0128] In one or more embodiments, the number of hidden positions in the first training sample is N, where N is a positive integer;

[0129] The model pre-training module 104 trains the pre-trained language model according to the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model for performing the following steps:

[0130] Perform a logarithmic operation on the predicted probabilities of N hidden positions to obtain the logarithmic value of the probability corresponding to each hidden position, and accumulate the logarithmic values ​​of the probability corresponding to each hidden position to determine the masked language modeling loss;

[0131] Determine a model training loss of the pre-trained language model based on the masked language modeling loss and the first sample similarity;

[0132] According to the model training loss, the network parameters of the pre-trained language model are iteratively trained until the model training loss meets the training end condition, and the training is stopped to obtain the trained pre-trained language model.

[0133] In one or more embodiments, the second item comparison module 105 generates a second training sample based on the second text representation, performs feature analysis on the second training sample and the second positive sample of the interacting character based on the trained pre-trained language model, and obtains a second sample similarity for performing the following steps:

[0134] Adding a marker text to the second text representation to obtain a second training sample, and determining a second positive sample of the interacting role;

[0135] The second training sample is encoded using the pre-trained language model to obtain a third sample embedding representation corresponding to the second training sample, and the second positive sample is encoded using the pre-trained language model to obtain a fourth sample embedding representation corresponding to the second positive sample;

[0136] The second sample similarity is obtained according to the third sample embedding representation, the fourth sample embedding representation, and the role embedding representation of the interacting role.

[0137] In one or more embodiments, the data processing device 1 may further include: an item input text acquisition module 107, an item embedding representation acquisition module 108, and an item embedding table generation module 109;

[0138] An item input text acquisition module 107 is configured to add a marker text to the first text representation of each item in the item set to obtain the item input text corresponding to each item in the item set;

[0139] An item embedding representation acquisition module 108 is configured to input the item input text corresponding to each item into the adjusted pre-trained language model, and obtain the item embedding representation corresponding to each item through the adjusted pre-trained language model;

[0140] The item embedding table generating module 109 is configured to add the item embedding representation corresponding to each item to the item embedding table.

[0141] In one or more embodiments, the data processing device 1 may further include: a training sample generating module 110 , a recommendation model training module 111 ;

[0142] A training sample generating module 110 is configured to generate a third training sample for the sequence recommendation model based on the item embedding representation in the item embedding table and the historical item sequence of the interactive role;

[0143] A recommendation model training module 111 is configured to train the sequence recommendation model according to the third training sample to obtain a trained sequence recommendation model;

[0144] Among them, the training of the sequence recommendation model includes the first stage and the second stage. The first stage is used to train the sequence modeling task and pause the training of the item embedding representation; the second stage is used to train the item embedding representation and pause the training of the sequence modeling task. The trained sequence recommendation model is used for item recommendation.

[0145] According to one embodiment of the present application, the steps involved in the data processing method shown in FIG2 above can be performed by the various modules in the data processing device 1 shown in FIG7 . For example, step S101 shown in FIG2 can be performed by the text acquisition module 101 shown in FIG7 , step S102 shown in FIG2 can be performed by the text prediction module 102 shown in FIG7 , step S103 shown in FIG2 can be performed by the first item comparison module 103 shown in FIG7 , step S104 shown in FIG2 can be performed by the model pre-training module 104 shown in FIG7 , step S105 shown in FIG2 can be performed by the second item comparison module 105 shown in FIG7 , step S106 shown in FIG2 can be performed by the model adjustment module 106 shown in FIG7 , and so on.

[0146] According to one embodiment of the present application, the various modules in the data processing device 1 shown in Figure 7 can be separately or all combined into one or several modules to constitute, or one (some) of the modules can be further divided into at least two smaller units in function, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In actual applications, the functions of one module can also be implemented by at least two units, or the functions of at least two modules can be implemented by one module. In other embodiments of the present application, the data processing device 1 may also include other modules or units. In actual applications, these functions can also be implemented with the assistance of other modules, and can be implemented by the collaboration of at least two modules.

[0147] In an embodiment of the present application, a first text representation corresponding to each item in the item set is obtained, and the first text representations corresponding to the items contained in the historical item sequence of each interactive character are spliced ​​to obtain a second text representation corresponding to the historical item sequence; a first training sample for training a pre-trained language model and a second training sample for adjusting the trained pre-trained language model are constructed based on the second text representation. Based on the first training sample, the pre-trained language model is trained using a dual-task strategy of masked language modeling (text prediction) and item comparison to obtain a trained pre-trained language model. Based on the second training sample, the pre-trained language model is adjusted using an item comparison strategy to obtain an adjusted pre-trained language model. The above-mentioned adjusted pre-trained language model can provide an initialized item embedding representation for sequence recommendation, and can make full use of the prior knowledge of the pre-trained language model to extract sequence features in the historical item sequence, thereby enhancing the effectiveness of the item embedding representation; the item embedding table of the sequence recommendation model is initialized by the adjusted pre-trained language model, which can improve the recommendation effect of the sequence recommendation model.

[0148] Please refer to Figure 8, which is a structural diagram of a computer device provided in an embodiment of the present application. As shown in Figure 8, the computer device 1000 can be a terminal device, for example, the terminal device 10a in the embodiment corresponding to Figure 1 above, or it can be a server, for example, the server 10d in the embodiment corresponding to Figure 1 above, which will not be limited here. For ease of understanding, this application takes the computer device as an example of a terminal device. The computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage. The memory 1005 may optionally be at least one storage device located away from the processor 1001. As shown in FIG8 , the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.

[0149] The network interface 1004 in the computer device 1000 can also provide network communication functions, and the optional user interface 1003 can also include a display and a keyboard. In the computer device 1000 shown in Figure 8, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0150] Obtaining a first text representation of each item in the item set, obtaining a historical item sequence of the interactive character, and generating a second text representation of the historical item sequence based on the first text representation;

[0151] Generate a first training sample according to the second text representation, perform text prediction on the hidden position in the first training sample according to the pre-trained language model, and obtain a prediction probability of the hidden position;

[0152] Performing feature analysis on the first training sample and the first positive sample of the interacting character according to the pre-trained language model to obtain a first sample similarity;

[0153] Training the pre-trained language model according to the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model;

[0154] generating a second training sample according to the second text representation, and performing feature analysis on the second training sample and a second positive sample of the interacting character according to the trained pre-trained language model to obtain a second sample similarity;

[0155] The trained pre-trained language model is adjusted according to the second sample similarity to obtain an adjusted pre-trained language model, and the adjusted pre-trained language model is used to initialize the embedding representation of the item.

[0156] It should be understood that the computer device 1000 described in the embodiments of the present application can execute the data processing method described in any of the embodiments shown in FIG. 2 and FIG. 5 , and can also execute the data processing device 1 described in the embodiment shown in FIG. 7 , and thus will not be described in detail here. Furthermore, the beneficial effects of using the same method will not be described in detail here either.

[0157] In addition, it should be noted that the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the data processing method in any of the embodiments in Figures 2 and 5 above. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed on a computer device for execution, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected by a communication network. Multiple computer devices distributed at multiple locations and interconnected by a communication network can constitute a blockchain system.

[0158] In addition, it should be noted that: the embodiment of the present application also provides a computer program product or computer program, which may include computer instructions, and the computer instructions may be stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor can execute the computer instructions so that the computer device performs the description of the data processing method in any of the embodiments in Figures 2 and 5 above, and therefore, will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0159] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different media contents, rather than to describe a specific order. In addition, the terms "including" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0160] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0161] The method and related apparatus provided in the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided in the embodiment of the present application, and specifically can be implemented by computer program instructions for each process and / or box of the method flow chart and / or structural diagram, and the combination of the process and / or box in the flow chart and / or block diagram. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes of the flow chart and / or one box or multiple boxes of the structural diagram. These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, and the instruction device implements the function specified in one process or multiple processes of the flow chart and / or one box or multiple boxes of the structural diagram. These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the structural diagram.

[0162] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0163] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data processing method, characterized in that: The method is executed by a computer device and includes: Obtaining a first text representation of each item in the item set, obtaining a historical item sequence of the interactive character, and generating a second text representation of the historical item sequence based on the first text representation; generating a first training sample according to the second text representation, and performing text prediction on the hidden position in the first training sample according to the pre-trained language model to obtain a prediction probability of the hidden position; performing feature analysis on the first training sample and the first positive sample of the interacting role according to the pre-trained language model to obtain a first sample similarity; Training the pre-trained language model according to the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model; generating a second training sample according to the second text representation, and performing feature analysis on the second training sample and a second positive sample of the interacting role according to the trained pre-trained language model to obtain a second sample similarity; The trained pre-trained language model is adjusted according to the second sample similarity to obtain an adjusted pre-trained language model, and the adjusted pre-trained language model is used to initialize the embedded representation of the item.

2. The method according to claim 1, characterized in that The step of obtaining a first text representation of each item in the item set, obtaining a historical item sequence of the interactive character, and generating a second text representation of the historical item sequence based on the first text representation includes: Obtaining an item type, an item identifier, and an item name of each item in the item set, and combining the item type, item identifier, and item name of the same item to obtain first text representations corresponding to each of the items; Obtaining a historical item sequence of the interactive character, and sorting the items in the historical item sequence in descending order according to the interaction time of the items in the historical item sequence to obtain a sorted historical item sequence; The first text representations of the items included in the sorted historical item sequence are concatenated to obtain a second text representation of the historical item sequence.

3. The method according to any one of claims 1 to 2, characterized in that Generating a first training sample according to the second text representation includes: determining the hidden position in the second text representation according to the text selection ratio, and determining the text representation of the hidden position as a candidate text representation; The candidate text representation is hidden to obtain a hidden text representation, the candidate text representation in the second text representation is replaced with the hidden text representation to obtain an initial sample, and a marker text is added to the initial sample to obtain a first training sample.

4. The method according to claim 3, characterized in that The step of performing a hidden processing on the candidate text representation to obtain a hidden text representation includes: Using the first hiding probability and the second hiding probability, performing hiding processing on the candidate text representation to obtain a hidden text representation; The first hiding probability refers to the probability of replacing the candidate text representation with a mask, and the second hiding probability refers to the probability of replacing the candidate text representation with a random text representation.

5. The method according to any one of claims 1 to 4, characterized in that The performing text prediction on the hidden position in the first training sample according to the pre-trained language model to obtain the prediction probability of the hidden position includes: Inputting the first training sample into the pre-trained language model, encoding the first training sample using the pre-trained language model to obtain a first sample embedding representation corresponding to the first training sample; Perform text prediction on the hidden position in the first training sample according to the first sample embedding representation to obtain a prediction probability of the hidden position.

6. The method according to any one of claims 1 to 5, characterized in that The performing feature analysis on the first training sample and the first positive sample of the interactive role according to the pre-trained language model to obtain a first sample similarity includes: Determining a subsequent interactive item of the interactive character, and determining a first text representation of the subsequent interactive item as a first positive sample of the interactive character; Inputting the first positive sample into the pre-trained language model, encoding the first positive sample through an encoder in the pre-trained language model to obtain a second sample embedding representation corresponding to the first positive sample; Obtain a role embedding representation of the interacting role, and obtain a first sample similarity based on the role embedding representation, the second sample embedding representation, and the first sample embedding representation corresponding to the first training sample.

7. The method according to any one of claims 1 to 6, characterized in that The number of the first training samples is M, where M is a positive integer; Obtaining a first sample similarity based on the role embedding representation, the second sample embedding representation, and the first sample embedding representation corresponding to the first training sample includes: Obtaining a first feature similarity between the role embedding representation and the second sample embedding representation, performing an exponential operation on the first feature similarity to obtain a first candidate similarity value; Obtaining a second feature similarity between the role embedding representation and the first sample embedding representation corresponding to each first training sample, performing an exponential operation on the second feature similarity to obtain a second candidate similarity value corresponding to each first training sample; The second candidate similarity values ​​corresponding to the first training samples are accumulated to obtain a cumulative similarity value, and the first sample similarity is determined according to a ratio between the first candidate similarity value and the cumulative similarity value.

8. The method according to any one of claims 1 to 7, characterized in that The number of the hidden positions in the first training sample is N, where N is a positive integer; The step of training the pre-trained language model according to the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model includes: Performing a logarithmic operation on the predicted probabilities of the N hidden positions to obtain a logarithmic value of the probability corresponding to each hidden position, and summing the logarithmic values ​​of the probability corresponding to each hidden position to determine the masked language modeling loss; Determining a model training loss of the pre-trained language model according to the masked language modeling loss and the first sample similarity; According to the model training loss, the network parameters of the pre-trained language model are iteratively trained until the model training loss meets the training end condition, and the training is stopped to obtain a trained pre-trained language model.

9. The method according to any one of claims 1 to 8, characterized in that Generating a second training sample according to the second text representation, and performing feature analysis on the second training sample and a second positive sample of the interacting role according to the trained pre-trained language model to obtain a second sample similarity includes: Adding a marker text to the second text representation to obtain a second training sample, and determining a second positive sample of the interactive role; encoding the second training sample using the pre-trained language model to obtain a third sample embedding representation of the second training sample, and encoding the second positive sample using the pre-trained language model to obtain a fourth sample embedding representation of the second positive sample; A second sample similarity is obtained according to the third sample embedding representation, the fourth sample embedding representation, and the role embedding representation of the interacting role.

10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: adding a marker text to the first text representation of each item in the item set to obtain an item input text corresponding to each item in the item set; Inputting the item input texts corresponding to the respective items into the adjusted pre-trained language model, and obtaining the item embedding representations corresponding to the respective items through the adjusted pre-trained language model; The item embedding representations corresponding to the respective items are added to the item embedding table.

11. The method according to any one of claims 1 to 10, characterized in that The method further comprises: generating a third training sample for a sequence recommendation model according to the item embedding representation in the item embedding table and the historical item sequence of the interactive character; Training the sequence recommendation model according to the third training sample to obtain a trained sequence recommendation model; The training of the sequence recommendation model includes a first stage and a second stage. The first stage is used to train the sequence modeling task and suspend the training of the item embedding representation; the second stage is used to train the item embedding representation and suspend the training of the sequence modeling task. The trained sequence recommendation model is used for item recommendation.

12. A data processing device, characterized in that: include: a text acquisition module, configured to acquire a first text representation of each item in the item set, acquire a historical item sequence of the interactive character, and generate a second text representation of the historical item sequence based on the first text representation; a text prediction module, configured to generate a first training sample based on the second text representation, and perform text prediction on a hidden position in the first training sample based on a pre-trained language model to obtain a prediction probability of the hidden position; A first item comparison module is configured to perform feature analysis on the first training sample and the first positive sample of the interactive character according to the pre-trained language model to obtain a first sample similarity; A model pre-training module, configured to train the pre-trained language model according to the first sample similarity and the predicted probability of the hidden position to obtain a trained pre-trained language model; a second item comparison module, configured to generate a second training sample based on the second text representation, and perform feature analysis on the second training sample and a second positive sample of the interacting character based on the trained pre-trained language model to obtain a second sample similarity; A model adjustment module is used to adjust the trained pre-trained language model according to the second sample similarity to obtain an adjusted pre-trained language model, and the adjusted pre-trained language model is used to initialize the embedded representation of the item.

13. A computer device, characterized in that: including memory and processor; The memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 11.

15. A computer program product, characterized in that The method comprises a computer program / instruction, which implements the method according to any one of claims 1 to 11 when the computer program / instruction is executed by a processor.

Citation Information

Patent Citations

  • Language model pre-training method, result recommendation method and related device

    CN114565104A

  • Article recommendation method and device based on artificial intelligence, equipment and storage medium

    CN117217858A

  • Serialized recommendation method and device based on long user behaviors and storage medium

    CN117390074A

  • Data processing method and device, equipment and medium

    CN118861671A

  • Intent detection

    US20230136527A1

Cited By

  • Large model optimization method and device, equipment and storage medium

    CN120373404A

  • Recommendation method for enhancing user behavior characteristics through large language model

    CN121526708A