Latent space decoding generative recommendation method and system based on large language model

By constructing memory modules and aggregating hidden states in the hidden space of the large language model, the problems of low inference efficiency and high cost in the recommendation system are solved, and low-cost personalized product recommendations are achieved.

CN119887349BActive Publication Date: 2025-08-26UNIV OF SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510361574.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-08-26
Estimated Expiration
2045-03-26

AI Technical Summary

Technical Problem

In recommendation systems based on large language models, there is a problem of low inference efficiency and high cost when decoding recommended products. Especially when generating multiple product lists, it is difficult for the prior art to effectively reduce inference costs while maintaining recommendation performance.

Method used

By building a memory module, the hidden state of the large language model is used to generate matching pairs of training samples, and the hidden states associated with the product are aggregated in the hidden space to generate a representation of candidate products, calculate the similarity sort to generate a recommendation list, avoid autoregressive decoding.

Benefits of technology

It significantly reduces the overhead of decoding products in large language models, while maintaining excellent recommendation performance, and achieving low-cost personalized product recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887349B_ABST
    Figure CN119887349B_ABST
Patent Text Reader

Abstract

The present invention discloses a latent space decoding generative recommendation method and system based on a large language model. The method comprises: (1) constructing a memory module, generating and storing matching pairs of hidden states of training samples and real products through a user-product interaction dataset, wherein the hidden state is obtained by extracting the last hidden state of the last layer of the input instruction from the large language model; (2) generating candidate product representations, aggregating hidden states associated with the same product from the memory module to generate a latent space representation of the candidate product; (3) decoding the product, calculating the similarity between the hidden state of the test sample and the candidate product representation, and generating a recommendation list based on the similarity sorting. The present invention directly decodes from the latent space of the large language model, that is, only one forward propagation of the large language model is required to obtain the hidden state of the user input, avoiding autoregressive decoding. The overhead of decoding products of the large language model is significantly reduced, while maintaining excellent recommendation performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of generative recommendation technology, and more specifically to a latent space decoding generative recommendation method and system based on a large language model. Background Art

[0002] Due to the powerful capabilities of large language models (LLMs), researchers are currently focusing on applying them to recommendation systems, resulting in the currently popular LLM-based recommendation paradigm. Unlike traditional recommendation systems, this paradigm redesigns recommendation systems within a "language space," where tasks and related entities (i.e., users and products) are described in natural language. In this paradigm, LLMs typically perform recommendation tasks generatively—fine-tuning the LLM to directly generate (decode) products in the language space. This approach closely aligns with the generative properties of LLMs and effectively leverages their powerful generative capabilities to achieve impressive results.

[0003] When decoding recommended products in the language space, reasoning efficiency faces huge challenges. Figure 2 As shown in (a), when decoding the language space, the large language model must autoregressively generate its representation (such as the title, which consists of multiple tokens, and the generation of each token depends on the previous token), which will incur a large time cost. To make matters worse, each recommendation request usually requires generating a list of items, so the inference cost is linearly related to the number of generated items. Although existing grounding technologies can reduce the number of items that large language models need to generate by mapping each generated item representation to multiple actual items, it is impractical to reduce the number of generated items excessively because mapping only a few items to a long recommendation list will reduce the recommendation performance. Therefore, to achieve higher recommendation performance of large language models, it is necessary to increase the inference cost several times higher than generating a single item, which is unrealistic. Summary of the Invention

[0004] In this embodiment, a latent space decoding generative recommendation method, system, electronic device, and storage medium based on a large language model are provided, which can directly decode products in the latent space rather than the language space, achieving excellent recommendation performance at a low cost.

[0005] In a first aspect, an embodiment of the present invention provides a latent space decoding generative recommendation method based on a large language model, the latent space decoding generative recommendation method based on a large language model comprising:

[0006] (1) Construct a memory module to generate and store matching pairs of hidden states of training samples and real products through the user-product interaction dataset. The hidden state is obtained by extracting the last hidden state of the last layer of the input instruction from the large language model;

[0007] (2) Generating candidate product representations by aggregating hidden states associated with the same product from the memory module to generate a latent space representation of the candidate product;

[0008] (3) Product decoding: Calculate the similarity between the hidden state of the test sample and the representation of the candidate product, and generate a recommendation list based on the similarity sorting.

[0009] In an optional embodiment, the construction process of the memory module includes:

[0010] Convert user interaction history into fixed template instruction data;

[0011] The instruction data is encoded through a large language model, and the last hidden state of the last layer is extracted.

[0012] In an optional embodiment, the aggregation in step (2) includes a global aggregation strategy and a local aggregation strategy.

[0013] In an optional embodiment, the global aggregation strategy includes:

[0014] All hidden states of the same product in the memory module are averaged to form a global product representation.

[0015] In an optional embodiment, the local aggregation strategy includes:

[0016] Based on the hidden state of the test sample, retrieve the most similar M hidden states from the memory module;

[0017] The retrieved latent states are grouped and aggregated by items to generate candidate item representations related to the user.

[0018] In an optional embodiment, the retrieval of the most similar M hidden states is achieved by calculating the inverse of the L2 distance, where the L2 distance is defined as the Euclidean distance between the hidden state of the test sample and the hidden state in the memory module.

[0019] In an optional embodiment, in the local aggregation strategy, the value of M is dynamically adjusted according to the test scenario. In scenarios with dense user interactions, the value of M is increased to improve personalization, and in scenarios with sparse user interactions, the value of M is decreased to reduce noise.

[0020] Compared with the prior art, the latent space decoding generative recommendation method based on a large language model of the present invention has the following beneficial effects:

[0021] This invention can be applied to generative recommendation platforms based on large language models, significantly reducing the cost of decoding products using the large language model while maintaining excellent recommendation performance. The L2D method of the present invention decodes directly from the latent space of the large language model. This means that only a single forward propagation of the large language model is required to obtain the hidden state of the user input, avoiding autoregressive decoding. The memory module's (hidden state, real product) matching pairs are used to generate product representations in the latent space. For each product, the relevant hidden states paired with the product are aggregated to create a representation of the product. This approach effectively models the characteristics of a product. Leveraging the current user's state information, the M most relevant hidden states are retrieved. These hidden states constitute the real products, which contain the user's personalized information. Through aggregation, a personalized product representation can be formed.

[0022] In a second aspect, an embodiment of the present invention provides a latent space decoding generative recommendation system based on a large language model, including:

[0023] The memory module is configured to: generate and store matching pairs of hidden states of training samples and real products from a user-product interaction dataset, where the hidden states are obtained by extracting the last hidden state of the last layer of the input instruction from the large language model;

[0024] a candidate product representation generation module configured to: aggregate hidden states associated with the same product from the memory module to generate a latent space representation of the candidate product;

[0025] The product decoding and recommendation module is configured to calculate the similarity between the hidden state of the test sample and the representation of the candidate products, and generate a recommendation list based on the similarity sorting.

[0026] In a third aspect, an embodiment of the present invention provides an electronic device comprising a processor, a communication interface, a memory and a bus, wherein the processor, the communication interface and the memory communicate with each other through the bus, and the processor can call logic instructions in the memory to execute the steps of the method provided in the first aspect.

[0027] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the latent space decoding generative recommendation method based on a large language model as described in the first aspect are implemented.

[0028] Compared with the prior art, the beneficial effects of the latent space decoding generative recommendation system, electronic device, and storage medium based on a large language model of the present invention are the same as those of the latent space decoding generative recommendation method based on a large language model described in the first aspect, so they will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0030] Figure 1 Flowchart of a latent space decoding generative recommendation method based on a large language model in an embodiment of the present invention;

[0031] Figure 2 Schematic diagram of language space decoding and latent space decoding in an embodiment of the present invention;

[0032] Figure 3 This is a schematic diagram of a latent space decoding generative recommendation method based on a large language model in an embodiment of the present invention;

[0033] Figure 4 This is a comparison chart of the time overhead of the L2D method on the CDs and Games datasets in an embodiment of the present invention;

[0034] Figure 5 This is a performance comparison chart of the L2D method on the CDs and Games datasets in an embodiment of the present invention;

[0035] Figure 6 A comparison diagram of the L2D method in dense and sparse scenarios according to an embodiment of the present invention;

[0036] Figure 7 4 is a structural block diagram of a latent space decoding generative recommendation system based on a large language model in an embodiment of the present invention;

[0037] Figure 8 2 is a structural block diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0038] In order to more clearly understand the purpose, technical solutions and advantages of this application, this application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0039] Unless otherwise defined, technical or scientific terms used in this application shall have the ordinary meanings as understood by persons of ordinary skill in the art to which this application belongs. The terms "a," "an," "the," "these," and similar expressions in this application do not denote limitations on quantity and may be singular or plural. The terms "comprise," "include," "have," and any variations thereof, as used in this application, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include unlisted steps or modules (units) or other steps or modules (units) inherent to the process, method, product, or device. The terms "connected," "connected," "coupled," and similar expressions used in this application are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. As used in this application, "plurality" means two or more. "And / or" describes an association between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone; A and B exist simultaneously; or B exists alone. Generally, the character " / " indicates that the objects in the preceding and following relationship are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0040] First, the basic concepts of generative recommendation based on large language models are explained, and then the latent space decoding generative recommendation method (L2D method) based on large language models is formally introduced.

[0041] The basic concept of generative recommendation based on large language model: D represents the user-item interaction dataset. The jth sample in D is represented as ,in Represents the user's interaction history, are the products that users in this sample have interacted with. It is worth noting that and In order to train the generative recommendation system based on the large language model, each sample Convert to instruction data, using a fixed prompt template, such as "The user interacted with the following items: < >; Which product does the user want next? ", at this time is the real product that the large language model expects to output. Then, the instruction data Can be used to fine-tune large language models.

[0042] When the large language model is inferred, given the user's interaction history s to generate the next item that the user may like, the large language model first encodes prompt(s) into a hidden state in the form of:

[0043]

[0044] Where h represents the last hidden state of the input prompt(s) in the last layer, and Represents a function that extracts the last hidden state from the last layer of the large language model. In traditional language space decoding methods, h is further mapped to the output layer of the large language model to generate the first token of the product (each product title is composed of multiple tokens), which is then added to the input and the process is repeated to generate the complete product title. In contrast, this scheme explores decoding products directly from the hidden state h, as shown in the following example. Figure 2 (b) and Figure 3 shown.

[0045] Specifically, an embodiment of the present invention provides a latent space decoding generative recommendation method based on a large language model. Figure 1 This is a flowchart of the latent space decoding generative recommendation method based on a large language model of the present invention. Figure 1 As shown, the process includes the following steps:

[0046] S100: Build a memory module to generate and store matching pairs of (hidden state, real product) of training samples using the user-product interaction dataset. The hidden state is obtained by extracting the last hidden state of the last layer of the input instruction from the large language model.

[0047] It should be noted that the construction process of the memory module includes:

[0048] Convert user interaction history into fixed template instruction data;

[0049] The instruction data is encoded through a large language model, and the last hidden state of the last layer is extracted.

[0050] Specifically, a memory module is constructed to store (hidden state, real product) matching pairs from training samples. These matching pairs are derived from real user-product interaction data, which means that the hidden state reflects the characteristics of a certain aspect of the corresponding product and can be further used to generate the product representation. Specifically, for the first training samples , we calculate its final hidden state in the last layer, expressed as: , and Stored in the memory module Memory (abbreviated as Mem). Repeat this process for all samples in the training set, and construct the final memory module Mem based on the latent space decoding generative recommendation method (L2D) of the large language model, which is expressed as,

[0051]

[0052] Where N represents the total number of training samples, and then Mem is used to generate the representation of candidate products.

[0053] S200: Generate candidate product representations by aggregating hidden states associated with the same product from the memory module to generate a latent space representation of the candidate product.

[0054] After building the memory module, L2D uses the (hidden state, real product) matching pairs of the memory module Mem to generate the representation of the candidate products in the latent space. For each product, it aggregates the relevant hidden states paired with the product as a real product to generate the representation of the product.

[0055] It should be noted that the aggregation in step S200 includes a global aggregation strategy and a local aggregation strategy.

[0056] The global aggregation strategy includes taking the average of all hidden states of the same product in the memory module to form a global product representation.

[0057] First, let's explain global aggregation. To aggregate the hidden states stored in the memory module Mem to generate the representation of a candidate product, a simple method is to directly average all the hidden states paired with the same product. Global aggregation follows this strategy. Specifically, the hidden states in the memory module Mem are first grouped by product, and then the hidden states within each group are averaged to form the representation of the corresponding product. Expressed by the formula, that is, for a product v, its representation h v The calculation is as follows:

[0058] ;

[0059] Where Mem(v) represents the set of all hidden states associated with item (commodity) v, defined as:

[0060] ;

[0061] The size of Mem(v) is expressed as express.

[0062] Next, we will explain local aggregation. Local aggregation strategies include:

[0063] Based on the hidden state of the test sample, retrieve the most similar M hidden states from the memory module;

[0064] The retrieved latent states are grouped and aggregated by items to generate candidate item representations related to the user.

[0065] Specifically, a product may contain multiple feature aspects, and the global aggregation method combines all aspects to form a comprehensive product representation. However, during the inference phase, not all feature aspects are relevant to each test sample; only the aspects relevant to the test sample are important. That is, mixing all aspects may introduce interference. Considering this, local aggregation is proposed, which only uses the top M samples in Mem that are most relevant to the hidden state of the test sample to generate the representation of the candidate product. Specifically, for a test sample (S t ,), first according to the hidden state h of the test sample t Filter out some of the Mem (hidden state, real product) matching pairs, recorded as Mem t . Expressed as:

[0066] in the largest first M};

[0067] in, Measure the hidden state h in Mem j And the hidden state h of the test sample t Then, for Mem t Apply a strategy similar to global aggregation to obtain the representation of the candidate item. Given a candidate item v, the representation is as follows:

[0068] ;

[0069] in, Indicates the size of Mem(v), Mem t (v) is the Mem containing the candidate v as the real product t A subset of , defined as:

[0070] ;

[0071] It should be noted that in the local aggregation strategy, the value of M is dynamically adjusted according to the test scenario. When the user interaction is dense, the M value is increased to improve personalization, and when the user interaction is sparse, the M value is reduced to reduce noise.

[0072] Compared to global aggregation, local aggregation can better focus on the characteristics of the test sample, potentially improving subsequent matching performance. However, due to the lack of relevant hidden states, local aggregation may have difficulty handling sparse product representations. Furthermore, while the representation obtained by global aggregation is uniform for all test samples, the representation obtained by local aggregation is different and is tailored to each test sample.

[0073] S300: Product decoding, calculating the similarity between the hidden state of the test sample and the representation of the candidate products, and generating a recommendation list based on the similarity sorting.

[0074] Retrieving the most similar M hidden states is achieved by calculating the inverse of the L2 distance, which is defined as the Euclidean distance between the hidden state of the test sample and the hidden state in the memory module.

[0075] Specifically, after generating the representation of the candidate product, L2D can efficiently decode the product contained in the latent space during the inference process by measuring the similarity between the hidden state of the test sample and the candidate product representation. Specifically, for a given test sample, its hidden state is h t and candidate product v, and the representation of the candidate product is recorded as h v , which is defined as:

[0076] ;

[0077] Then, use L2 distance to calculate h t and h v The similarity score between:

[0078] ;

[0079] Once the similarity scores of all candidate items are calculated, the top K items with the highest similarity scores to the test sample are selected to form the final recommendation list. The globally aggregated L2D is called L2D-G, and the locally aggregated L2D is called L2D-L.

[0080] We conduct experiments on two real-world datasets to demonstrate the effectiveness of the L2D approach in balancing performance and inference overhead.

[0081] like Figure 4 Figure 2 shows a comparison of the performance and time overhead of L2D and traditional methods on the CDs and Games datasets. The vertical axis is the recommended performance of the model, and the horizontal axis is the time overhead required by the model.

[0082] like Figure 5 As shown, Figure 5 This is a performance comparison of L2D and traditional methods on the CDs and Games datasets.

[0083] In order to verify the effectiveness of the L2D method, Figure 4 The performance and inference cost of our approach compared to traditional methods are shown in . Figure 5 The performance of our method under different @K values ​​is shown in Figure 2. From the figure and table, we can find that:

[0084] When evaluating the performance of all methods against the inference cost, Figure 4 As can be seen in the figure, the points closer to the upper left corner indicate better performance at a lower cost. The L2D method of the present invention is closest to the upper left corner on both datasets, indicating that L2D achieves excellent performance while maintaining low inference cost, demonstrating the effectiveness of directly decoding products in the latent space. Even compared with the previous most effective large language model-based method AlphaRec, which uses a large language model as embedding, L2D's cost is at least five times lower and achieves better performance, further demonstrating the significant potential of L2D in deployment in real-world scenarios.

[0085] When comparing the performance of traditional autoregressive generation methods under different beam sizes, it is observed that the performance of traditional autoregressive generation methods improves approximately linearly with the increase of beam size and inference cost. The larger the number of beams, the more items can be generated at a time by traditional methods based on large language models. 3 Demonstrating stronger scalability (larger growth rates). It would not be surprising if these methods were indeed able to outperform L2D by increasing the inference overhead (for example, increasing the beam size to 50), but this could result in a nearly 100-fold increase in cost, which is unfeasible in most real-world scenarios. Furthermore, our experiments used Llama3.2-1B as the base model, a relatively small large language model. Using larger large language models would result in higher costs.

[0086] When comparing two variants of the proposed L2D method, L2D-G and L2D-L, we observed that L2D-L performed more stably on both datasets, with only a slight increase in computational overhead. This demonstrates the effectiveness and robustness of the user-specific local memory module tailored to the user. Furthermore, while L2D-G's performance was not as stable as L2D-L, it still had a significant overhead advantage over other traditional methods.

[0087] In addition, if Figure 5 As shown in Figure 3, L2D outperforms all traditional methods in all metrics. The ability of this method to effectively decode multiple user interests in the latent space of a large language model significantly increases the likelihood of satisfying the user's current interests, further demonstrating the robustness and scalability of this method.

[0088] Figure 6 (a), (b), (c) and (d) show the performance of our method BIGRec (traditional), L2D-G and L2D-L in dense and sparse scenarios, respectively.

[0089] Furthermore, we describe the application and characteristics of two L2D decoding strategies in sparse and dense recommendation scenarios. L2D-L demonstrates stable performance compared to L2D-G. However, because L2D-L is designed to create user-specific memory modules from the hidden states of test samples, it may not be applicable in scenarios where user-item interactions are very sparse. To analyze this, the test set is divided into sparse and dense categories based on the interaction frequency of items in the training set. Figure 6 The overall performance of the two strategies in these scenarios is shown.

[0090] The following observations are made: (1) Dense scenarios: L2D-L performs best due to the large number of hidden states for each item, which enables it to create more personalized candidate item representations and eliminate irrelevant information. (2) Sparse scenarios: The interaction frequency of items is very low, that is, the hidden states corresponding to each item are very limited, which means that even the most similar hidden states may not accurately represent user preferences, which may lead to biased results and performance degradation. In contrast, L2D-G provides more balanced results through global aggregation. In summary, L2D-G and L2D-L each have their own advantages and disadvantages, but our decoding strategy allows flexible switching between the two methods to adapt them to different scenarios.

[0091] In summary, the L2D method of the present invention decodes directly from the latent space of the large language model, that is, only the large language model needs to be forward propagated once to obtain the hidden state of the user input, avoiding the decoding of the autoregressive method. The (hidden state, real product) matching pair of the memory module Mem is used to generate the representation of the product in the latent space. For each product, it aggregates the relevant hidden states paired with the product to create the representation of the product. This method can effectively model the characteristics of a product. L2D-L will use the current user's state information to retrieve the most relevant M hidden states. These hidden states constitute the Mem t L2D contains personalized user information and, through aggregation, forms personalized product representations. It leverages existing large language models to generate product representations and uses the L2 distance as a metric. This achieves excellent recommendation results without the need to train additional models.

[0092] The embodiments of the present invention also provide a latent space decoding generative recommendation system based on a large language model, which is used to implement the above-mentioned method embodiments. The terms "module", "unit", "sub-unit", etc. used below can implement a combination of software and / or hardware for predetermined functions. Although the system described in the following embodiments is preferably implemented in software, implementation by hardware or a combination of software and hardware is also possible and conceivable.

[0093] like Figure 7 As shown, Figure 7 This is a block diagram of the latent space decoding generative recommendation system based on a large language model in the present invention, which includes:

[0094] The memory module 101 is configured to: generate and store matching pairs of hidden states of training samples and real products from a user-product interaction dataset, where the hidden states are obtained by extracting the last hidden state of the last layer of the input instruction from the large language model;

[0095] The candidate product representation generation module 102 is configured to: aggregate hidden states associated with the same product from the memory module to generate a latent space representation of the candidate product;

[0096] The product decoding and recommendation module 103 is configured to calculate the similarity between the hidden state of the test sample and the representation of the candidate products, and generate a recommendation list based on the similarity sorting.

[0097] The latent space decoding generative recommendation system based on a large language model of the present invention has the same principle as the latent space decoding generative recommendation method based on a large language model described above, so it will not be described in detail here.

[0098] Figure 8 A structural block diagram of an electronic device provided by an embodiment of the present invention, such as Figure 8 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the following method:

[0099] Construct a memory module to generate and store matching pairs of hidden states of training samples and real products using the user-product interaction dataset. The hidden state is obtained by extracting the last hidden state of the last layer of the input instruction from the large language model.

[0100] Generating candidate product representations by aggregating hidden states associated with the same product from the memory module to generate a latent space representation of the candidate product;

[0101] Product decoding: Calculate the similarity between the hidden state of the test sample and the candidate product representation, and generate a recommendation list based on the similarity sorting.

[0102] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0103] An embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method provided in the above embodiments is implemented.

[0104] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or certain parts of the embodiment.

[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A latent space decoding generative recommendation method based on a large language model, characterized by: The latent space decoding generative recommendation method based on a large language model includes: (1) Construct a memory module to generate and store matching pairs of hidden states of training samples and real products through the user-product interaction dataset. The hidden state is obtained by extracting the last hidden state of the last layer of input instruction data from the large language model; The process of building a memory module includes: Convert user interaction history into fixed template instruction data; Encode the instruction data through a large language model and extract the last hidden state of the last layer; (2) Generating candidate product representations by aggregating hidden states associated with the same product from the memory module to generate a latent space representation of the candidate product; (3) Product decoding: Calculate the similarity between the hidden state of the test sample and the latent space representation of the candidate product, and generate a recommendation list based on the similarity sorting.

2. The latent space decoding generative recommendation method based on a large language model according to claim 1, characterized in that The construction process of the memory module includes: Convert user interaction history into fixed template instruction data; The instruction data is encoded through a large language model, and the last hidden state of the last layer is extracted.

3. The latent space decoding generative recommendation method based on a large language model according to claim 1, characterized in that The aggregation includes a global aggregation strategy and a local aggregation strategy.

4. The latent space decoding generative recommendation method based on a large language model according to claim 3, characterized in that The global aggregation strategy includes: All hidden states of the same product in the memory module are averaged to form a global product representation.

5. The latent space decoding generative recommendation method based on a large language model according to claim 3, characterized in that The local aggregation strategy includes: Based on the hidden state of the test sample, retrieve the most similar M hidden states from the memory module; The retrieved latent states are grouped and aggregated by items to generate candidate item representations related to the user.

6. The latent space decoding generative recommendation method based on a large language model according to claim 5, characterized in that The retrieval of the most similar M hidden states is achieved by calculating the inverse of the L2 distance, where the L2 distance is defined as the Euclidean distance between the hidden state of the test sample and the hidden state in the memory module.

7. The latent space decoding generative recommendation method based on a large language model according to claim 5, characterized in that In the local aggregation strategy, the value of M is dynamically adjusted according to the test scenario. In scenarios with dense user interactions, the value of M is increased to improve personalization, and in scenarios with sparse user interactions, the value of M is decreased to reduce noise.

8. A latent space decoding generative recommendation system based on a large language model, characterized by: include: The memory module is configured to: generate and store matching pairs of hidden states of training samples and real products from a user-product interaction dataset, where the hidden states are obtained by extracting the last hidden state of the last layer of input instruction data from the large language model; The process of building a memory module includes: Convert user interaction history into fixed template instruction data; Encode the instruction data through a large language model and extract the last hidden state of the last layer; a candidate product representation generation module configured to: aggregate hidden states associated with the same product from the memory module to generate a latent space representation of the candidate product; The product decoding and recommendation module is configured to calculate the similarity between the hidden state of the test sample and the latent space representation of the candidate products, and generate a recommendation list based on the similarity sorting.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the latent space decoding generative recommendation method based on a large language model is implemented according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the latent space decoding generative recommendation method based on a large language model are implemented as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multi-modal large language model training method and system based on multi-modal encoder

    CN117218498A

  • E-commerce intelligent recommendation system based on user behavior big data

    CN119671686A