Universal explainable sequence recommendation method and system based on multi-task self-prompting technology

By employing multi-task self-prompting technology and utilizing a self-prompting generator to generate personalized prompts, the sequential recommendation and explanation generation modules are optimized. This addresses the issue of low efficiency in multi-task collaboration and long sequence processing in deep recommendation models, achieving efficient sequential recommendation and high-quality explanation generation.

CN119202408BActive Publication Date: 2026-07-14SHANDONG NORMAL UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANDONG NORMAL UNIV
Filing Date
2024-09-09
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing deep recommendation models lack knowledge sharing and mutual reinforcement between sequential recommendation and explanation generation tasks, and are inefficient when processing long input sequences, making it difficult to achieve efficient multi-task module collaboration.

Method used

We employ a multi-task self-prompting technique, generating personalized prompts through a self-prompting generator. We combine pre-training and prompt fine-tuning strategies to optimize the order recommendation and explanation generation modules, and use a short sequence input strategy to improve efficiency.

Benefits of technology

It achieves efficient synchronization of sequential recommendation and explanation generation, improving the model's time and space efficiency, and enhancing recommendation accuracy and explanation generation quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202408B_ABST
    Figure CN119202408B_ABST
Patent Text Reader

Abstract

The application discloses a general interpretable sequence recommendation method and system based on a multi-task self-prompting technology, belongs to the technical field of sequence recommendation, acquires a user interaction sequence, pre-trains a sequence recommendation module and a self-prompting generator based on the user interaction sequence; constructs a short input sequence based on the latest interaction of the user interaction sequence, inputs the short input sequence into the pre-trained sequence recommendation module, obtains an embedding representation of the short input sequence, inputs the embedding representation into the pre-trained self-prompting generator, extracts user features and generates personalized prompts of the user features; alternately prompts and fine-tunes the pre-trained sequence recommendation module and the pre-trained explanation generation module based on the personalized prompts of the user features, predicts a user recommendation result and generates a natural language explanation. A flexible and efficient multi-task interpretable sequence recommendation framework ARTS is provided, accurate personalized recommendation is provided for a recommendation result, and a high-quality natural language explanation is generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of sequence recommendation technology, and in particular relates to a general interpretable sequence recommendation method and system based on multi-task self-prompting technology. Background Technology

[0002] The statements in this section are merely background information relating to this disclosure and do not necessarily constitute prior art.

[0003] The rapid development of deep learning technology has significantly enhanced the modeling capabilities of recommender systems, enabling them to provide users with more personalized and accurate recommendations. However, deep recommender models are often considered black-box models, and their recommendation results lack interpretability. In recent years, large language models (LLMs) have attracted widespread attention from academia and industry due to their excellent semantic understanding and language generation capabilities. They have been widely applied in various fields, especially natural language processing (NLP) and computer vision (CV). The success of pre-trained LLMs provides a new perspective for achieving high-quality interpretability in recommender systems.

[0004] Existing methods for generating natural language explanations for recommendation results using LLMs typically focus on transforming pre-trained user and item representations into explanatory text. These standalone explanation generation models only focus on a single explanation task, neglecting the collaborative relationship between sequential recommendation and explanation generation tasks, thus failing to achieve knowledge sharing and mutual enhancement among multi-task modules.

[0005] Achieving knowledge sharing and mutual reinforcement between multi-task modules—sequential recommendation and explanation generation—faces two significant challenges: First, jointly learning sequential recommendation and explanation generation tasks is extremely challenging. Sequential recommendation models aim to predict a user's next interaction based on their historical interaction sequence, while explanation generation generates corresponding natural language explanations based on the target user and recommended items, explaining why the item was recommended to the target user. These two tasks use different training data and have different task objectives. Furthermore, sequential recommendation models and LLMs typically have different numbers of parameters, leading to significant differences in prior knowledge and learning capabilities among the modules in the multi-task framework, making collaborative training even more difficult.

[0006] Secondly, sequential recommendation models and LLMs possess strong memory capabilities for processing input sequences, enabling them to effectively explore and exploit dependencies between items in long sequences. However, their runtime and memory consumption are typically influenced by the length of the input sequence; longer input sequences require more time and space resources to process. Therefore, while longer input sequences can improve model performance, they pose a significant challenge to time and space efficiency. Summary of the Invention

[0007] To overcome the shortcomings of the existing technologies, this invention provides a general interpretable sequence recommendation method and system based on multi-task self-suggestion technology. It offers a flexible and efficient multi-task interpretable sequential recommendation framework, ARTS. The ARTS framework leverages the excellent semantic understanding capabilities of LLMs to achieve mutual enhancement between sequential recommendation and explanation generation tasks. By providing accurate personalized recommendations and generating high-quality natural language explanations for the recommendation results, the ARTS framework effectively enhances user trust and interactive experience.

[0008] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:

[0009] In a first aspect, the present invention provides a general interpretable sequence recommendation method based on multi-task self-prompting technology, including:

[0010] Obtain user interaction sequences, and pre-train a sequence recommendation module and a self-prompting generator based on the user interaction sequences;

[0011] A short input sequence is constructed based on the latest interaction in the user interaction sequence. The short input sequence is then input into a pre-trained sequence recommendation module to obtain the embedding representation of the short input sequence. The embedding representation is then input into a pre-trained self-prompt generator to extract user features and generate personalized prompts based on user features.

[0012] Personalized prompts based on user characteristics alternately fine-tune the pre-trained sequence recommendation module and the pre-trained explanation generation module, predicting user recommendation results and generating natural language explanations.

[0013] In a further technical solution, the embedding representation is obtained through a random embedding method.

[0014] A further technical solution involves adding an embedding vector before the embedding representation of the short input sequence and then inputting it into the self-prompting generator.

[0015] In a further technical solution, the self-prompt generator introduces a position embedding matrix during pre-training to learn the sequence relationship of user interaction sequences.

[0016] A further technical solution involves using contrastive learning to enhance the personalized prompts generated by the self-prompting generator.

[0017] A further technical solution for fine-tuning the pre-trained sequence recommendation module includes: adding the personalized prompts to the beginning of the short input sequence to obtain an enhanced short input sequence; inputting the enhanced short input sequence into the pre-trained sequence recommendation module for fine-tuning to obtain an optimized sequence recommendation module.

[0018] A further technical solution involves fine-tuning the pre-trained explanation generation module by constructing an input prompt sequence based on item embedding, user prompts, and personalized prompts from the sequence recommendation module. This input prompt sequence is then fed into the pre-trained explanation generation module for fine-tuning, resulting in an optimized explanation generation module.

[0019] Secondly, this invention provides a general interpretable sequence recommendation system based on multi-task self-prompting technology, comprising:

[0020] The pre-training module is configured to: acquire user interaction sequences and pre-train a sequence recommendation module and a self-prompting generator based on the user interaction sequences;

[0021] The prompt generation module is configured to: construct a short input sequence based on the latest interaction of the user interaction sequence, input the short input sequence into a pre-trained sequence recommendation module to obtain the embedding representation of the short input sequence, input the embedding representation into a pre-trained self-prompt generator, extract user features and generate personalized prompts based on user features;

[0022] The prompt fine-tuning module is configured to alternately fine-tune the pre-trained sequence recommendation module and the pre-trained explanation generation module with personalized prompts based on user features, predict user recommendation results and generate natural language explanations.

[0023] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the general interpretable sequence recommendation method based on multi-task self-prompting technology as described in the first aspect.

[0024] Fourthly, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the general interpretable sequence recommendation method based on multi-task self-prompting technology as described in the first aspect.

[0025] The above one or more technical solutions have the following beneficial effects:

[0026] This invention proposes a general and efficient multi-task self-prompting framework, ARTS, for interpretable sequential recommendations, achieving efficient simultaneous generation of accurate sequential recommendations and high-quality explanations. The ARTS framework introduces a novel self-prompting generator that automatically generates personalized prompts with comprehensive semantics based on user interaction sequences, thereby promoting efficient knowledge sharing among multi-task modules. This is the first time that prompt learning has been applied to the simultaneous generation of recommendations and explanations, successfully resolving the trade-off between performance and time / space efficiency.

[0027] This invention proposes a pre-training and prompting fine-tuning strategy for training multi-task modules, effectively improving the efficiency of knowledge sharing among multiple tasks and realizing efficient joint learning and mutual reinforcement between the sequential recommendation and explanation generation modules in the ARTS framework. The short-sequence input strategy based on generated personalized prompts significantly improves the time and space efficiency of the multi-task sequential framework.

[0028] This invention also proposes a short-sequence input strategy based on generated personalized prompts and recent user interactions. This strategy effectively increases the information density of the input sequence and significantly reduces its length. It effectively addresses the time and space efficiency issues of multi-task sequential models while ensuring model performance.

[0029] Extensive experiments conducted on four real-world datasets demonstrate that ARTS outperforms existing technologies by 5% to 10% in sequential recommendation accuracy and by 10% in explained generation performance. Furthermore, various experiments were designed to validate the effectiveness and efficiency of each module and the generality of the proposed ARTS, proving its ability to enhance the performance and time-space efficiency of both sequential recommendation and explained generation models. Attached Figure Description

[0030] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0031] Figure 1 This is a flowchart of the general interpretable sequence recommendation method according to embodiments of the present invention;

[0032] Figure 2 This is a framework diagram of the multi-task self-promotion framework ARTS in an embodiment of the present invention;

[0033] Figure 3 These are the comparative experimental results of ARTS in the embodiments of the present invention;

[0034] Figure 4 This is the result of the influence of the input length prompt on the model efficiency in the embodiment of the present invention;

[0035] Figure 5 This is the result of the influence of the sequence data length on the model efficiency in the input length of this embodiment of the invention. Detailed Implementation

[0036] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0037] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0038] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0039] Terminology Explanation:

[0040] Explainable recommendations refer to personalized recommendation algorithms that not only provide users with recommendation results, but also explanations to clarify why specific items were recommended. These explanations can cover the interpretability of recommendation inputs (e.g., user models), recommendation processes (e.g., algorithms), and / or recommendation outputs (e.g., products).

[0041] Example 1

[0042] See appendix Figure 1 As shown, this embodiment discloses a general interpretable sequence recommendation method based on multi-task self-prompting technology, which includes the following steps:

[0043] Obtain user interaction sequences, and pre-train a sequence recommendation module and a self-prompting generator based on the user interaction sequences;

[0044] Based on the latest interaction in the user interaction sequence, a short input sequence is constructed. The short input sequence is input into the pre-trained sequence recommendation module to obtain the embedding representation of the short input sequence. The embedding representation is then input into the pre-trained self-prompt generator to extract user features and generate personalized prompts based on user features.

[0045] Personalized prompts based on user characteristics alternately fine-tune the pre-trained sequence recommendation module and the pre-trained explanation generation module, predicting user recommendation results and generating natural language explanations.

[0046] The aforementioned general interpretable sequence recommendation method is implemented using the proposed ARTS framework. ARTS is a general and efficient multi-task self-prompting framework for interpretable sequential recommendation. ARTS mainly consists of three modules: (1) a sequence recommendation module, responsible for predicting the user's potential next interaction based on the provided user interaction sequence; (2) an explanation generation module, used to synchronously generate natural language explanations for the recommendation results; and (3) a self-prompting generator, a module built on the Transformer architecture, designed to extract global user behavior features from the user interaction sequence and generate personalized continuous prompts. As a core component of the ARTS framework, the self-prompting generator promotes efficient knowledge sharing among multiple tasks and significantly improves the time and space efficiency of ARTS.

[0047] To achieve collaborative optimization and mutual enhancement among multiple tasks, a pre-training and prompt fine-tuning strategy is designed based on the proposed self-prompt generator. Specifically, in the pre-training stage, a sequential recommendation task is designed, and the sequential recommendation model and self-prompt generator are fully pre-trained using all available sequence data. In the prompt fine-tuning stage, the pre-trained self-prompt generator is used to generate personalized prompts representing the user's global semantic features. Then, the pre-trained sequential recommendation model and explanation generation module are alternately fine-tuned based on the generated personalized prompts. This strategy can effectively improve the prediction accuracy and explanation generation quality of sequential recommendation, while significantly improving the time and space efficiency of the multi-task sequential framework.

[0048] It should be noted that ATRS is a highly general interpretable recommendation framework that is compatible with most existing sequential recommendation models and language generation models.

[0049] I. Pre-training phase of the ARTS framework

[0050] 1) Pre-training of the sequential recommendation module

[0051] In this embodiment, based on the target user's interaction sequence, the system predicts the next item the user is most likely to interact with and generates a natural language explanation to intuitively explain why these items are recommended.

[0052] Specifically, let U and V represent the sets of users and items, respectively. Each user u∈U has a corresponding comment for each interacting item v∈V, expressed as:

[0053]

[0054] Among them, |E u,v | is the length of the comment, e i This refers to words in a comment.

[0055] Each user has a chronological sequence of interactions, expressed as:

[0056]

[0057] Among them, |S u | Indicates the number of interactive items. This represents the item that user u interacts with at step t.

[0058] Specifically, to avoid the vanishing or exploding gradient problems during model training, the length of the user interaction sequence is normalized to a maximum length l. s If the length of the user interaction sequence exceeds the maximum length l s Then only the user's most recent (latest) l will be retained. s Create a sequence of interactive items to form a user interaction sequence. Otherwise, populate the sequence.

[0059] ARTS is a general framework that supports the most popular sequential recommendation models as its sequential recommendation module. In this embodiment, to ensure clarity and conciseness in the method description, the well-known and structurally simple SASRec method is used as the sequential recommendation module. In the experimental section, the generality and effectiveness of the framework will be verified by replacing the sequential recommendation module with a more advanced model. In sequential recommendation, SASRec is a pioneering model that integrates a self-attention mechanism into the sequential recommendation algorithm, effectively capturing user behavior patterns in the user's historical interaction sequence.

[0060] The sequential recommendation module stacks L layers of Transformer blocks to encode historical behavior sequences for the input sequence. The embedding representation of the input sequence is obtained through a random embedding method, expressed as follows:

[0061]

[0062] Among them, Z θ It is a random initialization function used to convert item IDs into advanced characteristics. Represents a random embedding of the input layer sequence. Represents interactive items The initial representation of , where d is the dimension of the item representation.

[0063] The following embedding representation of the l-th layer can be obtained. The expression is:

[0064]

[0065] in, This represents the t-th action of user u at level l.

[0066] After layer L, the embedding representation from layer L is used. To represent the latest preferences of the target user, it is represented as u o And use it to predict the next interactive item for the target user.

[0067] The pre-training optimization objective of the sequential recommendation module can be expressed as:

[0068]

[0069] Among them, S + ={(u,v i )} represents the set of positive examples, where user u and item v are... i There was interaction; S - ={(u,v j )} represents the set of negative examples, consisting of items v that user u has not interacted with and that are randomly sampled. j Composition; σ(·) is the sigmoid function.

[0070] 2) Explain the pre-training of the generation module

[0071] The ARTS framework offers high flexibility in selecting natural language generation models and supports major generative network architectures such as Transformer, BERT, and GPT. With the rapid development of generative artificial intelligence, the GPT series models have received widespread attention in education, mathematics, medicine, and physics. Considering that the GPT series models have been extensively pre-trained on large corpora and possess excellent natural language understanding and generation capabilities, and also taking into account the computational resource consumption during model fine-tuning, this embodiment selects the pre-trained GPT-2 as the explanation generator. Since GPT-2 has already been pre-trained, it will not be further trained during the pre-training stage.

[0072] 3) Pre-training of the self-prompting generator

[0073] Cue learning is an emerging technique that introduces specific cues to guide model learning, demonstrating success in research fields such as NLP and CV. Traditional cue learning methods typically use manually constructed discrete cues to guide the model in performing specific tasks. These cues may include text extracts or structured inputs. While traditional discrete cue methods have made progress in guiding model learning, they have consistently faced difficulties in adapting to the specific needs of individual users and generating personalized cues. This limitation reduces their adaptability to different task scenarios. Unlike discrete cues, continuous cues do not rely on manually designed fixed text templates. Instead, they obtain optimized cue vectors through an automated training process.

[0074] This embodiment proposes a self-prompt generator, which aims to generate personalized, continuous prompts for each user that integrate global features extracted from the user's interaction sequence. The self-prompt generator automatically supplements and extracts global user behavior features based on the user's historical interaction sequence, and then converts them into personalized prompts. The self-prompt generator effectively improves the efficiency of knowledge sharing among multiple tasks and enhances the time and space efficiency of sequential frameworks.

[0075] In the implementation of the self-prompt generator, considering the outstanding performance of Transformer in sequence data mining, a self-prompt generator was built based on the Transformer encoder structure.

[0076] Specifically, a random embedding method is used to initialize the user interaction sequence S. u To input embedding, the expression is:

[0077] H u =f θ (S u )

[0078]

[0079] Among them, H u It is a sequence embedding. f represents the representation of user u's t-th action. θ This represents a random initialization function.

[0080] Similar to ViT's [class] tagging, a learnable cls-token embedding cls∈R is randomly generated. d And adding it before the user interaction sequence embedding can be represented as The output of the cls state from the self-prompt generator contains general characteristics of the user interaction sequence, reflecting the user's global behavioral patterns. This is used as a user-specific, continuous cue for downstream multi-task learning.

[0081] The architecture of the Transformer-based self-prompt generator is as follows:

[0082] To preserve location information, a learnable location embedding matrix is ​​introduced as additional information, enabling the model to learn the sequential relationships between user interactions. The expression for the location embedding matrix is:

[0083]

[0084] After integrating the location embedding, the expression for the resulting feature representation M is:

[0085]

[0086] The Transformer-based self-prompt generator consists of n layers, each layer comprising two sublayers: a multi-head self-attention network and a position-wise feedforward network. Multi-head self-attention enables the model to simultaneously attend to information from different positions, spanning various representation subspaces. Assuming the multi-head self-attention sublayer contains c attention heads, the p-th head in the l-th layer can be computed as follows:

[0087]

[0088] Q = MW Q K = MW K V = MW V

[0089]

[0090] Matrix M through W Q W K W V Converted to MW Q MW K and MW V ,and

[0091] Where, d k B represents the dimension of the p-th head. l,p It is A after normalization l,p As a result, Z l,p This represents the final aggregation.

[0092] This represents a mask matrix used to enable different items to attend to each other, thereby capturing the contextual relationships between them. Specifically, an autoregressive masking technique is employed in the self-attention layer to capture the sequential nature of the data. During model training, this strategy ensures that user behavior predictions rely solely on the user's historical behavior. By masking future positions and assigning them negative infinity values, queries are restricted to considering only preceding key-value pairs and their current positions. Therefore, the lower triangular portion of the matrix is ​​0, and the other positions are negative infinity, meaning that the current sequence only considers preceding sequences, not future sequences.

[0093] According to the formula, the multi-head output value is obtained. They are then concatenated and projected to obtain a multifaceted representation of layer l. The process is as follows:

[0094] Z l =Concat(z 1 ,z 2 ,...,z c W o

[0095]

[0096] Among them, W O It is a mapping matrix.

[0097] To stabilize the training process and improve the model's generalization ability, normalization layers and dropout layers are introduced to obtain the item embedding representation F of the l-th layer. l Z is represented from multiple aspects of the input. l The expression is:

[0098] F l =Dropout(LayerNorm(Z) l )).

[0099] In the pre-training phase, a sequential recommendation task was designed to fully pre-train the self-prompt generator, enabling it to comprehensively learn the sequence patterns of user behavior and transfer the user's global behavioral features to the generated personalized prompts. Specifically, the output F of the n-layer self-prompt generator was utilized... t n To represent a user based on a given t items (i.e. The preference of ) is then determined. Then, an MF layer is appended after the self-suggestion generator to predict the relevance of candidate item v, expressed as:

[0100]

[0101] N∈R v×d

[0102] Where, r v,t Let |v| represent the probability that item v becomes the next item given the first t items, where N is an item embedding matrix and |v| is the number of items.

[0103] The objective function based on cross-entropy can be expressed as:

[0104]

[0105] Where S is the set of input sequences, and σ represents the sigmoid function.

[0106] Given a user interaction sequence It is preceded by a (cls) flag, which allows the self-prompt generator to generate corresponding sequence outputs based on user behavior patterns learned during the pre-training phase. Specifically, p contains global feature information of the user sequence, which can serve as the user's global behavioral preferences. In this paper, p is used as a personalized user-specific cue, which plays a crucial role in subsequent multi-task cue fine-tuning and efficiency optimization. The proposed user-specific cue enables the ARTS framework to outperform sequence recommendation methods that use full sequence inputs by utilizing only the user's most recent (latest) interactions, thereby achieving the goal of enhancing recommendation performance while effectively improving the model's time and space efficiency. Finally, the item embeddings and parameters of the trained sequential recommendation model and self-cue generator are preserved for future use.

[0107] 4) Contrastive learning is used to augment the input sequence in both the pre-training and prompting fine-tuning stages of the self-prompting generator.

[0108] Contrastive learning (CL) has demonstrated its effectiveness in recommender systems. Existing CL-based recommender models typically leverage self-supervised signals to augment supervised data, improving the robustness and effectiveness of user representations. Inspired by these methodologies, a personalized augmentation method for user-specific cues based on contrastive learning is proposed. Specifically, two data augmentation methods are applied to the interaction sequence. On one hand, random masking is performed to generate an augmented view of the interaction sequence. On the other hand, random noise is introduced to generate another augmented view of the interaction sequence.

[0109] The two enhanced views are defined as follows:

[0110]

[0111] Then, a cls flag was added to the beginning of both sequence views, specifically as follows:

[0112]

[0113] The tagged sequence view is then input into the prompt generator, represented as follows:

[0114]

[0115] in, and It is the output of the self-suggestion generator on two enhanced sequence graphs, p R and p D Enhance global behavioral features, f PG It is a prompt generator.

[0116] During model training, the original sequence representation of the user (u) and its corresponding augmented counterpart are considered as positive pairs. Other users in the same batch The remaining enhancement prompts indicate that Forming negative pairs

[0117] To simplify the calculation, the cosine similarity function sim(·,·) is used to measure the similarity between representations. The contrastive learning loss function can then be defined as follows:

[0118]

[0119] Where N is the training batch size and τ is the temperature hyperparameter. A cue-oriented contrastive learning loss is used as an auxiliary task for fully training personalized cues. Finally, the optimization objective of the self-cue generator is defined as follows:

[0120] L PG =L PG_predict +γ*L CL

[0121] Here, γ is a hyperparameter used to control the weights of the contrastive learning task.

[0122] II. Fine-tuning phase of the ARTS framework

[0123] The following section details the prompt-tuning method proposed by the ARTS framework. During the prompt-tuning phase, three pre-trained modules of the framework are collaboratively prompted based on personalized, user-specific prompts: the sequence recommendation module, the self-prompt generator, and the explanation generator.

[0124] Since a pre-trained self-prompt generator can construct personalized prompts representing the user's global interest features from user sequences, a short sequence input strategy based on generated personalized prompts is designed. This strategy effectively improves the performance of sequence recommendation and explanation generation, while also significantly improving the time and space efficiency of the entire framework. Specifically, the maximum input sequence length is set to l. t ,l t <<l s During the prompt-tuning phase, the user's last (most recent) interaction is selected to construct a short input sequence. Then, the pre-trained sequence recommendation module is used to obtain the embedding representation of the short input sequence:

[0125]

[0126] Among them, Z θ It is the pre-trained encoder for the sequence recommendation module. This is a representation of the short input sequence. Next, the well-trained cls-token is added to the beginning of the sequence representation to obtain the input sequence representation. Similar to the pre-training phase, positional information is integrated into the representation of the input sequence, which is then fed into a pre-trained self-prompt generator to obtain the output representation.

[0127] To fully leverage the prior knowledge learned by the pre-trained explanation generator and better utilize short input sequences to construct personalized prompts, a contrastive learning design from the pre-training phase is applied to the prompt-tuning of the self-prompt generator. Details are omitted here.

[0128] For prompt-tuning of the pre-trained sequence recommendation module, the output p of the self-prompt generator is used as a personalized prompt for the user and added to the beginning of the input sequence to obtain a short input sequence with enhanced prompts. Then The input is fed into the pre-trained sequence recommendation module for prompt-tuning. The objective function and optimization method are the same as in the pre-training stage, and will not be described in detail here.

[0129] Considering the time and space efficiency of running large language models online, and the need for highly personalized explanation generation, it is crucial to fully utilize global user behavior features in the generated personalized prompts p to construct the input prompt sequence, aiming to provide the most personalized information while keeping the prompt sequence as short as possible. Furthermore, although it contains a wealth of semantic information related to user behavior features, it still cannot fully describe other potential factors influencing user decisions. Therefore, we introduce user and item IDs as auxiliary prompt information into the input prompt sequence of the explanation generator. Intuitively, we could treat user and item IDs as special token words and add them to the vocabulary of the explanation generator. However, there may be millions or even billions of users and items in a recommender system. Predicting an accurate ID word from such a large set of IDs is extremely difficult and time-consuming. Therefore, instead of adding IDs to the vocabulary, we treat them as two different additional types of tokens. Specifically, to effectively transfer item features to the explanation generator, facilitate the generation of personalized explanations, and promote multi-task collaborative optimization, we directly use the item embedding i learned by the pre-trained sequence recommendation model. In addition, we randomly embed userIDs to represent other potential factors considered in the user's decision-making process and use them as additional user prompts, denoted as u.

[0130] Then, the input prompt sequence for the self-prompt generator can be represented as [u, p, i]. It is noteworthy that the prompt sequence consists of only 3 tokens, but they can provide rich user and item feature details for the explanation generator during the online recommendation phase. Therefore, our framework can significantly improve the time and space efficiency of pre-trained large language models while generating high-quality personalized explanations.

[0131] When prompting the interpreter generator, the prompt [u,p,i] will be a representation of user u's comment on item i. Combined, the notation for constructing the input sequence is as follows:

[0132] Interpreting the generator's input notation involves combining the input sequence with positional representations. Combined, it integrates positional information for each item in the sequence, represented as X = [x1, x2, ..., x...]. |X| The output of the interpreter generator is represented as... And add a linear layer to X o Each tag represents Mapped to size On the vector, where This represents the number of words in the vocabulary. The process can be represented as:

[0133]

[0134] in and These are the projection weights and the bias, c. i Let represent the probability distribution of the words. Then, the objective function based on the negative log-likelihood can be written as:

[0135]

[0136] in, This indicates that e is generated in step i. i The probability of a specific word. Since specific cues are included in the sequence provided to the model, these cues occupy certain positions within the sequence. Therefore, when predicting the probability of a specific word, the index positions need to be adjusted according to the length of these cues to correctly align the predicted word with the actual word. The offsets correspond to the three prompts, namely u, i, and p.

[0137] The goal of this embodiment is to recommend content that users may be interested in, while providing intuitive and easy-to-understand natural language explanations for the recommendations. Therefore, the ARTS framework includes two task modules: a sequential recommendation module and an explanation generation module. Traditional multi-task learning methods typically combine the loss functions of multiple tasks for joint optimization. However, due to the differences in task objectives and training data, combining the losses of the two modules in the ARTS framework for joint optimization is challenging.

[0138] To address this issue, a multi-task alternating optimization strategy is proposed. This strategy uses a self-prompt generator as a shared module and the generated personalized prompts as a knowledge-sharing channel, allowing the sequential recommendation module and the explanation generation module to alternately fine-tune the prompts. Specifically, firstly, the sequential recommendation module and the self-prompt generator are optimized based on the loss function of the sequential recommendation task:

[0139] L SR_PG =λ*L SR +γ*L CL

[0140] Where λ and γ are hyperparameters.

[0141] Next, we simultaneously optimize both the explanation generator and the self-prompt generator. The loss function for this optimization can be expressed as:

[0142] L EG_PG = (1-λ)*L EG .

[0143] The proposed alternating prompting fine-tuning strategy enables the self-prompting generator to simultaneously learn and share the latest training knowledge from both the sequential recommendation module and the interpretation generator. It mitigates the differences in optimization objectives between different tasks, effectively promotes knowledge sharing among multi-task modules, and achieves mutual reinforcement between the sequential recommendation and interpretation generation tasks.

[0144] The goal of this invention is to provide accurate sequential recommendations while generating personalized and easily understandable natural language explanations for the recommendations. To this end, a general and efficient multi-task self-hinting framework (ARTS) for interpretable sequential recommendations is proposed. This framework, based on generated comprehensive semantic hints, improves the collaborative performance and time-space efficiency of the multi-task modules. Specifically, a novel self-hinting generator is proposed to generate personalized hints based on user interaction sequences, effectively expressing the user's global interest features. Based on these hints, a short sequence input strategy is designed, and pre-training and hint fine-tuning strategies are used to optimize the framework parameters, achieving simultaneous improvement in both sequential recommendation and explanation generation performance. Furthermore, due to the generation of personalized hints and the short sequence input strategy, this invention also improves the time and space efficiency of both the sequential recommendation model and the explanation generation model, effectively resolving the trade-off between recommendation performance and time-space efficiency. Extensive experiments verify the effectiveness of the proposed ARTS framework in improving recommendation accuracy and explanation generation quality. In addition, experiments were designed to comprehensively verify the generality of the proposed framework and its effectiveness in improving the time and space efficiency of sequence models.

[0145] experiment:

[0146] Regarding the data: Experiments were conducted on four real-world datasets collected from two platforms: Amazon and Yelp, to comprehensively evaluate the ARTS framework. For all datasets, a 10-core filter was first applied, meaning unpopular items and low-interaction users with fewer than 10 interaction records were removed. Then, to fine-tune the explanation generator's hints, the large language model Alpaca was used to summarize the reviews in the dataset, extracting key information from the reviews to form concise, realistic reviews limited to 20 words. Finally, the datasets were split into training and test sets in an 8:2 ratio.

[0147] Regarding evaluation metrics: Two types of task metrics were used to evaluate the multi-task performance of ARTS. A traditional full-ranking protocol was employed. This approach offers several advantages, such as comprehensive consideration of all items, alignment with real-world recommendation scenarios, and independence from negative sampling strategies. To validate the effectiveness of the method in recommendation tasks, two widely accepted metrics were used: hit rate (HR@K) and normalized discount cumulative gain (NDCG@K). These metrics provide valuable insights into the performance of ARTS across various recommendation scenarios. Furthermore, to evaluate the quality of natural language interpretations, mature metrics commonly used in interpretable recommendation and text summarization tasks, such as BLEU and ROUGE, were employed. These metrics comprehensively assess the quality of generated interpretations.

[0148] Regarding the comparison models: The ARTS framework involves two types of tasks: sequential recommendation and interpretable generation. To comprehensively evaluate the framework's performance, two types of methods—sequential recommendation and generatively based interpretable recommendation—were selected as the baseline for comparison. Sequential recommendation methods include SASRec, ICLRec, FMLPRec, and MELTRec, while generatively based interpretable recommendation methods include Att2Seq, NRT, PETER, and PEPLER.

[0149] Regarding the experimental results: Figure 2 As shown, by observing the experimental results, it was found that the proposed ARTS significantly outperforms state-of-the-art sequential recommendation methods on every dataset. In terms of NDCG and HR, ARTS achieves at least a 5% improvement across all datasets. This performance improvement is attributed to user-specific cues generated by the self-prompt generator, which contain rich semantic details and effectively reflect the user's global interests and preferences. Since the pre-trained cue generator contains prior knowledge related to user interests, the generated cuees can provide rich user preference information for the sequential recommendation model. This enables the sequential recommendation model to effectively predict the user's next action based solely on the user's most recent (latest) interaction.

[0150] ARTS also significantly outperforms state-of-the-art generative interpretable recommendation methods, achieving at least a 6% improvement across all datasets. This improvement is attributed to the rich semantic knowledge contained in the continuous prompts generated by the self-prompting generator and our designed alternating optimization strategy. To improve the online time and space efficiency of the interpretable generator, the input prompt sequence contains only 3 tags. Under this setting, the performance improvement of interpretable generation strongly demonstrates the effectiveness of our learned continuous prompts.

[0151] The performance improvement is attributed to our multi-task alternating optimization strategy. This strategy treats the self-suggestion generator as a shared module, and its personalized suggestions as a knowledge-sharing channel. This allows the backbone sequential recommendation model and the interpretive generation model to be fine-tuned with alternating suggestions. This effectively bridges the gap between the two different tasks and improves the performance of interpretive generation.

[0152] Performance comparisons between SASRec and ARTSS, and between ICLRec and ARTSI, clearly demonstrate that the ARTS framework effectively improves the recommendation performance of the sequential recommendation module. For explanation generation, ARTS significantly outperforms PEPLER across all metrics. PEPLER also uses GPT-2 to generate natural language explanations, validating the effectiveness of the proposed prompting fine-tuning strategy based on the self-prompting generator in explanation generation tasks. Furthermore, experimental results validate the generality and scalability of the proposed framework.

[0153] For explanation generation tasks, relying solely on quantitative evaluation metrics cannot comprehensively assess the quality of the generated explanation language. Therefore, we provide examples of explanation generation for baseline models and the proposed ATRS. Qualitative evaluation of the explanations generated by ATRS shows that it outperforms other baselines in terms of accuracy, readability, and richness of detail.

[0154] In terms of spatiotemporal efficiency, both SASRec and GPT-2 employ a self-attention mechanism to calculate the correlation between all items in the sequence at each time step, thus their time complexity is proportional to the sequence length n and the size d of each mini-batch, typically O(n^2). 2 *d). Regarding space complexity, both models have two main factors: the embedding matrix and the self-attention weight matrix. First, they both require an embedding matrix to store the representation of each item or tag. The size of the embedding matrix is ​​typically O(n*d). Second, since they both use a self-attention mechanism, the self-attention weight matrix occupies O(n*d) space. 2 Therefore, the overall space complexity of SASRec and GPT-2 is O(n*d) for the embedding matrix and O(n*d) for the self-attention weight matrix. 2 The sum of ), i.e. O(n 2+n*d).

[0155] In practical recommendation scenarios, existing sequential recommendation methods typically use relatively long sequences of user behavior to ensure the model can fully capture user preferences and improve recommendation performance. Similarly, explanation-generation models also require detailed, long-sequence prompts as input to generate natural language explanations that meet user needs. However, based on the theoretical analysis of time and space complexity above, it is clear that the time and space efficiency of both sequential recommendation models and explanation-generation models is sensitive to the length of the input sequence.

[0156] To verify the impact of input length on model efficiency, a series of experiments were conducted on the real-world Tampa dataset and a virtual dataset. In the Tampa dataset, the lengths of user interaction sequences vary considerably, providing an effective method for simulating real-world recommendation scenarios. Meanwhile, a synthetic dataset was used to generate user interaction sequences of equal length using a random generation method to verify the ideal situation of improved time and space efficiency. Figure 3 , Figure 4 The experimental results show a significant increase in both time and memory costs for sequential recommendation models and interpretive generation models. Therefore, in practical recommendation scenarios, the increase in input sequence length severely impacts the model's time and space efficiency. In this embodiment, the ATRS framework is proposed. This framework uses a self-suggestion generator to construct an efficient short sequence input strategy, achieving simultaneous improvement in model performance and efficiency, effectively addressing the aforementioned problems.

[0157] Example 2

[0158] This embodiment provides a general interpretable sequence recommendation system based on multi-task self-prompting technology, including:

[0159] The pre-training module is configured to: acquire user interaction sequences and pre-train a sequence recommendation module and a self-prompting generator based on the user interaction sequences;

[0160] The prompt generation module is configured to: construct a short input sequence based on the latest interaction of the user interaction sequence, input the short input sequence into a pre-trained sequence recommendation module to obtain the embedding representation of the short input sequence, input the embedding representation into a pre-trained self-prompt generator, extract user features and generate personalized prompts based on user features;

[0161] The prompt fine-tuning module is configured to alternately fine-tune the pre-trained sequence recommendation module and the pre-trained explanation generation module with personalized prompts based on user features, predict user recommendation results and generate natural language explanations.

[0162] Example 3

[0163] The purpose of this embodiment is to provide a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method of Embodiment 1.

[0164] Example 4

[0165] The purpose of this embodiment is to provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the method of Embodiment 1.

[0166] The steps and methods involved in the apparatuses of Embodiments 3 and 4 above correspond to those in Embodiment 1. For specific implementation details, please refer to the relevant description section of Embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood as including any medium capable of storing, encoding, or carrying an instruction set for execution by a processor and enabling the processor to perform any of the methods in this invention.

[0167] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computer device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. The present invention is not limited to any particular combination of hardware and software.

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

[0169] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.

Claims

1. A general interpretable sequence recommendation method based on multi-task self-suggestion technology, characterized in that, include: Implemented using the ARTS framework, it includes: a sequence recommendation module for predicting a user's potential next interaction based on a provided user interaction sequence; an explanation generation module for synchronously generating natural language explanations of the recommendation results; and a self-prompting generator, built on the Transformer architecture, for extracting global user behavior features from the user interaction sequence and generating personalized continuous prompts. Obtain user interaction sequences, and pre-train a sequence recommendation module and a self-prompting generator based on the user interaction sequences; A short input sequence is constructed based on the latest interaction in the user interaction sequence. The short input sequence is then input into a pre-trained sequence recommendation module to obtain the embedding representation of the short input sequence. The embedding representation is then input into a pre-trained self-prompt generator to extract user features and generate personalized prompts based on user features. Personalized prompts based on user characteristics alternately fine-tune the pre-trained sequence recommendation module and the pre-trained explanation generation module to predict user recommendation results and generate natural language explanations. Let U and V represent the sets of users and items, respectively. Each user u∈U has a corresponding comment for each interacting item v∈V, expressed as: in, Indicates the length of the comment. This refers to words in the comments; Each user has a chronological sequence of interactions, expressed as: in, Indicates the quantity of interactive items. This represents the item that user u interacts with at step t.

2. The general interpretable sequence recommendation method based on multi-task self-prompting technology as described in claim 1, characterized in that, The embedding representation is obtained through a random embedding method.

3. The general interpretable sequence recommendation method based on multi-task self-suggestion technology as described in claim 1, characterized in that, An embedding vector is added before the embedding representation of the short input sequence and then input into the prompt generator.

4. The general interpretable sequence recommendation method based on multi-task self-suggestion technology as described in claim 1, characterized in that, The self-prompting generator learns the sequence relationships of user interaction sequences by introducing a position embedding matrix during pre-training.

5. The general interpretable sequence recommendation method based on multi-task self-suggestion technology as described in claim 1, characterized in that, Use contrastive learning to enhance the personalized prompts generated by the self-prompt generator.

6. The general interpretable sequence recommendation method based on multi-task self-prompting technology as described in claim 1, characterized in that, The specific steps for fine-tuning the pre-trained sequence recommendation module include: adding the personalized prompts to the beginning of the short input sequence to obtain an enhanced short input sequence; inputting the enhanced short input sequence into the pre-trained sequence recommendation module for fine-tuning to obtain an optimized sequence recommendation module.

7. The general interpretable sequence recommendation method based on multi-task self-prompting technology as described in claim 1, characterized in that, The fine-tuning of the pre-trained explanation generation module specifically includes: constructing an input prompt sequence based on item embedding, user prompts, and personalized prompts from the sequence recommendation module; inputting the input prompt sequence into the pre-trained explanation generation module for fine-tuning to obtain an optimized explanation generation module.

8. A general interpretable sequence recommendation system based on multi-task self-prompting technology, employing the general interpretable sequence recommendation method based on multi-task self-prompting technology as described in any one of claims 1-7, characterized in that, include: The pre-training module is configured to: acquire user interaction sequences and pre-train a sequence recommendation module and a self-prompting generator based on the user interaction sequences; The prompt generation module is configured to: construct a short input sequence based on the latest interaction of the user interaction sequence, input the short input sequence into a pre-trained sequence recommendation module to obtain the embedding representation of the short input sequence, input the embedding representation into a pre-trained self-prompt generator, extract user features and generate personalized prompts based on user features; The prompt fine-tuning module is configured to alternately fine-tune the pre-trained sequence recommendation module and the pre-trained explanation generation module with personalized prompts based on user features, predict user recommendation results and generate natural language explanations.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps in the general interpretable sequence recommendation method based on multi-task self-prompting technology as described in any one of claims 1-7.

10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the general interpretable sequence recommendation method based on multi-task self-prompting technology as described in any one of claims 1-7.