Reasoning method and related device

By splitting the set of items in generative recommendation into subsets for parallel processing and using an accelerator to generate evaluation information, the problem of wasted computational resources in generative recommendation is solved, and a faster and more efficient recommendation process is achieved.

WO2026237854A1PCT designated stage Publication Date: 2026-11-19HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2026/095932
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-05-15
Filing Date
2026-05-09
Publication Date
2026-11-19

AI Technical Summary

Technical Problem

Generative recommendation requires a lot of computing resources for each inference process, mainly because the input token of the generative model includes user data and all candidate items, which leads to a waste of computing resources.

Method used

The candidate item set is split into multiple subsets, each of which is processed in parallel by an accelerator to generate evaluation information. This reduces the dependence on all candidate items in each inference process and utilizes accelerators such as NPU, GPU, ASIC or FPGA for parallel computing.

Benefits of technology

It significantly reduces the computer resource consumption of each reasoning process, improves the speed and efficiency of determining recommended items, and reduces communication overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026095932_19112026_PF_FP_ABST
    Figure CN2026095932_19112026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a reasoning method and a related device. The method comprises: acquiring input information of a generative model, wherein the input information comprises user data and an item set; dividing into a plurality of subsets a plurality of candidate items comprised in the item set, wherein each of the plurality of subsets comprises at least one item, and the user data and each subset are used for obtaining evaluation information of the at least one item in each subset by means of the generative model; and on the basis of the evaluation information of the at least one item in the plurality of subsets, determining, from the item set, at least one item to be recommended. In other words, user data and all candidate items in an item set are not considered as a whole, but all the candidate items are split. In this way, not all the candidate items need to be comprised in each reasoning process of a generative model, so that computer resources consumed in each reasoning process are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

A reasoning method and related equipment

[0001] This application claims priority to Chinese Patent Application No. 202510632296.7, filed on May 15, 2025, entitled "A Reasoning Method and Related Device", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of artificial intelligence (AI) technology, and in particular to a reasoning method and related equipment. Background Technology

[0003] Generative recommendation, with its groundbreaking technological paradigm, has become an important development direction in the field of recommender systems. Generative recommendation is a technique that combines generative models with recommender systems. Its core idea is to leverage the powerful fitting ability of generative models to learn the potential relationships between user data and items (such as movies, music, books, and products) to determine the items to recommend to the user.

[0004] Currently, after obtaining user data and a large number of candidate items, the common practice is to input the user data and all candidate items into a generative model. The generative model then uses a token-by-token generation mechanism to determine the recommended item. In detail, the token-by-token generation mechanism means that after inputting the user data and all candidate items into the generative model, in the first inference process, the generative model generates only one token. In the second inference process, the user data and all candidate items are concatenated with the token generated in the first inference process, which is then used as the input token for the second inference process. This process is repeated multiple times to obtain multiple tokens generated by the generative model. This method results in each inference process consuming a large amount of computing resources. Summary of the Invention

[0005] This application provides a reasoning method and related equipment for reducing the computer resources consumed in each reasoning process.

[0006] Firstly, this application provides a reasoning method applicable to various recommendation scenarios. Exemplarily, this method is used to determine at least one item to recommend to a user. For example, the item type may be a work, application, product, or service. Further, if an item is a work, a work may include at least one of the following: music, video, text, or image.

[0007] In this method, a first device acquires input information for a generative model, including user data and an item set, the item set comprising multiple candidate items. The multiple candidate items in the item set are divided into multiple subsets, each subset including at least one item. For example, the user data in the input information of the generative model is not segmented; instead, the user data and each subset are used to obtain evaluation information for at least one item in each subset through the generative model. The first device acquires the evaluation information for at least one item in the multiple subsets and, based on the evaluation information, determines at least one recommended item from the item set.

[0008] For example, the above steps are performed by a processor in the first device. The input information of the generative model in this application can also be replaced by an inference request referred to as a generative model.

[0009] Because the input tokens for each inference process of a generative model include user data and all candidate items, and each candidate item often includes multiple tokens, each inference process consumes a significant amount of computing resources. However, researchers have found that the evaluation information of different items is often independent. For example, if multiple candidate items include item 1 and item 2, obtaining the evaluation information of item 2 through the generative model often does not require consideration of item 1. Based on this idea, this implementation divides the multiple candidate items included in the item set into multiple subsets. Each subset includes at least one item. User data and each subset are used to obtain the evaluation information of at least one item in each subset through the generative model. Then, based on the evaluation information of at least one item in each subset, at least one recommended item is determined from the item set. In other words, instead of treating user data and all candidate items as a whole, all candidate items are split. Therefore, each inference process of the generative model no longer needs to include all candidate items, which helps reduce the computing resources consumed in each inference process.

[0010] In one possible implementation, the operation of obtaining evaluation information for entries in multiple subsets through a generative model is performed in parallel by multiple accelerators. Here, accelerators can also be referred to as accelerator cards, acceleration devices, or acceleration chips. For example, accelerators can be hardware accelerators such as embedded neural network processing units (NPUs), graphics processing units (GPUs), application-specific integrated circuits (ASICs), or field-programmable gate arrays (FPGAs).

[0011] In this implementation, splitting the entire item set into multiple subsets means breaking down the large task of generating evaluation information for all candidate items in the item set into multiple smaller tasks. The operation of obtaining evaluation information for recommended items in multiple subsets through the generative model is executed in parallel by multiple accelerators. This means that multiple accelerators execute multiple smaller tasks in parallel, which helps to obtain the required evaluation information more quickly, thus determining the recommended items faster and significantly reducing the latency of the recommendation process. Furthermore, since the generative model relies on user data and the item itself when generating evaluation information for a particular item, and the evaluation information of different items is often independent, this method of splitting the item set only, without splitting the user data, allows each accelerator to obtain complete user data and at least one item. Each accelerator can then independently generate evaluation information for the item based on the obtained data. In other words, each accelerator does not need to interact with other accelerators during the process of generating evaluation information for the item, thus avoiding the introduction of additional communication overhead.

[0012] In one possible implementation, the multiple accelerators include N accelerators, where N is an integer greater than 1. The first device divides the set of entries into multiple subsets, including: the first device dividing the candidate entries included in the set of entries into N subsets, each of the N subsets including at least one entry, and the N subsets corresponding one-to-one with the N accelerators. The method further includes: the first device sending one subset to each of the N accelerators. Exemplarily, the first device also sends first data to each of the N accelerators, the first data being obtained based on user data; for example, the first data is user data, or the first data is a key-value pair of user data.

[0013] In this implementation, the item set is divided into N subsets corresponding one-to-one with N accelerators. One subset is sent to each accelerator. In this way, each accelerator is used to generate evaluation information for the items in one subset. The N accelerators perform parallel inference to generate evaluation information for the items in the N subsets in parallel, providing a simple and easy-to-implement segmentation method.

[0014] In one possible implementation, the execution entity of the method is the processor of the first device. In one case, the processor and multiple accelerators are contained within the same server; in another case, the processor and multiple accelerators are contained within the same super pod. In this implementation, if the processor and N accelerators are contained within the same server, it means that the communication between the processor and the N accelerators is all within the same physical server, ensuring high communication speed between the processor and the N accelerators. Alternatively, if the processor and N accelerators are contained within the same super pod, it means that the communication between the processor and the N accelerators uses the high-speed communication network within the super pod, also ensuring high communication speed. Both architectures help reduce the latency of the overall process of determining recommended items and improve the efficiency of the overall process of determining recommended items.

[0015] In one possible implementation, the method further includes: a first device generating key-value pairs (KV) of user data; wherein the KV and each subset of the user data are used to obtain evaluation information for at least one item in each subset through a generative model. Exemplarily, the KV and each subset of the user data are used by the accelerator to obtain evaluation information for at least one item in each subset through a generative model; that is, the accelerator treats the KV and each subset of the user data as a whole when performing inference through the generative model.

[0016] In this implementation, key-value pairs (KVs) of user data can be pre-generated. In each inference process, the already generated KVs of user data can be directly reused, so there is no need to regenerate the KVs of user data in each inference process. This not only helps to further reduce the computer resources consumed in each inference process, but also helps to improve the speed of generating evaluation information of items through generative models, thereby reducing the latency of the process of determining recommended items.

[0017] In one possible implementation, the user data includes at least one set of historical behavioral data indicating at least one action performed by the user on an item. This implementation clarifies the components of the user data, improving its feasibility. Furthermore, since the historical behavioral data indicates at least one action performed by the user on an item, the user data can reflect the user's preferences for items. This facilitates the identification of items that better match the user's preferences based on their historical behavioral data, thus improving the user experience by recommending items the user likes.

[0018] In one possible implementation, the method further includes: a first device receiving a recommendation request, the recommendation request including user data and a set of items. Then, the first device obtains the input information for the generative model, including: the first device determining the user data and the set of items based on the received recommendation request, and then determining the input information for the generative model, the input information for the generative model including the user data and the set of items.

[0019] In this implementation, after receiving a recommendation request, the recommended items are determined in order to respond to the received recommendation request. The determined recommended items are then displayed to the user. In other words, the computer resources consumed in the process of determining the recommended items are effectively consumed, avoiding the waste of computer resources.

[0020] Secondly, this application provides a reasoning method for scenarios using generative models. Exemplarily, this method uses a generative model to determine at least one item to recommend to a user. The input information of the generative model includes user data and an item set, the item set including multiple candidate items. In this method, an accelerator receives first data and at least one item sent by a processor, wherein the first data is obtained based on user data, the item set includes multiple subsets, and the received at least one item belongs to a first subset of the multiple subsets. Based on the first data and at least one item in the first subset, the accelerator obtains evaluation information of at least one item in the first subset through the generative model and sends the evaluation information of at least one item in the first subset to the processor; wherein the evaluation information of at least one item in the multiple subsets is used by the processor to determine the at least one recommended item from the item set.

[0021] In one possible implementation, the first data is the key-value pairs (KV) of the user data. The accelerator, based on the first data and at least one entry from the first subset, obtains evaluation information for at least one entry from the first subset through a generative model, including: the accelerator, based on the KV of the user data and at least one entry from the first subset, obtains evaluation information for at least one entry from the first subset through a generative model.

[0022] In the second aspect of this application, the accelerator is also used to perform the steps executed by the accelerator in the first aspect and various possible implementations of the first aspect. The specific implementations of the steps in the second aspect, the meanings of the terms, and the beneficial effects are all described in the first aspect and will not be repeated here.

[0023] Thirdly, this application provides a reasoning apparatus, comprising: an acquisition unit for acquiring input information of a generative model, the input information including user data and an item set, the item set including multiple candidate items; a processing unit for dividing the item set into multiple subsets, each subset including at least one item, wherein the user data and each subset are used to obtain evaluation information of at least one item in each subset through the generative model; and the processing unit is further configured to determine at least one recommended item from the item set based on the evaluation information of at least one item in the multiple subsets.

[0024] In the third aspect of this application, the inference device is also used to perform the steps performed by the first device in the first aspect and various possible implementations of the first aspect. The specific implementations of the steps in the third aspect, the meanings of the terms, and the beneficial effects are all described in the first aspect and will not be repeated here.

[0025] Fourthly, this application provides an inference apparatus for use in scenarios employing generative models. The input information of the generative model includes user data and an item set, the item set including multiple candidate items. The apparatus includes: a transceiver unit for receiving first data and at least one item sent by a processor, wherein the first data is obtained based on user data, the item set includes multiple subsets, and the received at least one item belongs to a first subset among the multiple subsets; a processing unit for obtaining evaluation information of at least one item in the first subset based on the first data and at least one item in the first subset through a generative model; the transceiver unit is further configured to send the evaluation information of at least one item in the first subset to the processor, wherein the evaluation information of at least one item in the multiple subsets is used by the processor to determine at least one recommended item from the item set.

[0026] In the fourth aspect of this application, the inference device is also used to perform the steps executed by the accelerator in the second aspect and various possible implementations of the second aspect. The specific implementations of the steps in the fourth aspect, the meanings of the terms, and the beneficial effects are all described in the second aspect and will not be repeated here.

[0027] Fifthly, this application provides an apparatus including a processor and a memory, the processor being coupled to the memory, the memory storing program instructions, which, when executed by the processor, implement the method described in the first aspect.

[0028] In a sixth aspect, this application provides a system comprising a processor and an accelerator, the processor being configured to perform the method described in the first aspect, and the accelerator being configured to perform the method described in the second aspect.

[0029] In one possible implementation, the system has N accelerators. The operation of obtaining the evaluation information of recommended items in multiple subsets through the generative model is performed in parallel by the N accelerators, where N is an integer greater than 1.

[0030] In a seventh aspect, this application provides a computer program product comprising a program that, when run on a computer, causes the computer to perform the method described in the first aspect.

[0031] Eighthly, this application provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method described in the first aspect.

[0032] Ninthly, this application provides a chip system including a processor for supporting the implementation of the functions involved in the foregoing aspects, such as transmitting or processing data and / or information involved in the foregoing methods. In one possible design, the chip system further includes a memory for storing program instructions and data necessary for the terminal device or communication device. This chip system may be composed of chips or may include chips and other discrete devices.

[0033] The second to ninth aspects of this application correspond to the first aspect or multiple possible ways of the first aspect, and have corresponding beneficial effects. Attached Figure Description

[0034] Figure 1 is a schematic diagram of an inference system provided in an embodiment of this application;

[0035] Figure 2 is a flowchart illustrating one of the reasoning methods provided in this application;

[0036] Figure 3 is a schematic diagram of multiple historical behavior data provided in an embodiment of this application;

[0037] Figure 4 is a schematic diagram of generating user features through a machine learning model according to an embodiment of this application;

[0038] Figure 5 is a schematic diagram of processing the input information of a generative model according to an embodiment of this application;

[0039] Figure 6 is a schematic diagram of parallel inference using multiple accelerators provided in an embodiment of this application;

[0040] Figure 7 is another schematic diagram of parallel inference using multiple accelerators provided in an embodiment of this application;

[0041] Figure 8 is another flowchart illustrating the reasoning method provided in the embodiments of this application;

[0042] Figure 9 is a schematic diagram of a reasoning device provided in an embodiment of this application;

[0043] Figure 10 is a schematic diagram of another structure of the inference device provided in an embodiment of this application;

[0044] Figure 11 is a schematic diagram of a device provided in an embodiment of this application. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application are described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some, and not all, of the embodiments of this application. Those skilled in the art will recognize that, with the emergence of new application scenarios, the technical solutions provided by this application are also applicable to similar technical problems.

[0046] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such descriptions can be used interchangeably where appropriate to allow embodiments to be implemented in a sequence other than that illustrated or described in this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products, or devices. The naming or numbering of steps appearing in this application does not imply that the steps in the method flow must be performed in the chronological / logical order indicated by the naming or numbering. The execution order of named or numbered process steps can be changed according to the desired technical purpose, as long as the same or similar technical effect is achieved. The division of units in this application is a logical division. In practical applications, there may be other division methods. For example, multiple units may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the shown or discussed mutual coupling, direct coupling, or communication connection may be through some interface, and the indirect coupling or communication connection between units may be electrical or other similar forms, none of which are limited in this application. Furthermore, the units or sub-units described as separate components may or may not be physically separated, may or may not be physical units, or may be distributed among multiple circuit units. Some or all of the units can be selected to achieve the purpose of the solution in this application according to actual needs.

[0047] In this application, "send" and "receive" indicate the direction of signal transmission. For example, "send data to device XX" can be understood as the destination of the data being device XX. "Receive data from device YY" can be understood as the source of the data being device YY. "Send" can also be understood as the "output" of a chip interface, and "receive" can also be understood as the "input" of a chip interface. In other words, sending and receiving can occur between devices or within a device, for example, through a bus, trace, or interface between components, modules, chips, software modules, or hardware modules within the device.

[0048] The method provided in this application can be applied to various recommendation scenarios. For example, the method provided in this application is used to determine at least one item to recommend to a user. For instance, the type of the item may be a work, application, product, or service. Further, if the type of an item is a work, a work may include at least one of the following: music, video, text, or image.

[0049] The following examples illustrate various application scenarios of the method provided in this application. In one application scenario, the method provided in this application can be used on a shopping platform to determine at least one product to recommend to a user, wherein the shopping platform is a shopping application or shopping website, etc. In another application scenario, the method provided in this application can be used on a music platform to determine at least one musical work to recommend to a user, wherein the music platform is a music application or music website, etc.

[0050] In another application scenario, the method provided in this application embodiment can be used in a video platform to determine at least one video work to recommend to a user, wherein the video platform is manifested as a video application or video website, etc. In another application scenario, the method provided in this application embodiment can be used in an advertising platform to determine at least one advertisement to recommend to a user, wherein the type of advertisement can be goods, works, or services, etc. In yet another application scenario, the method provided in this application embodiment can be used in an app store to determine at least one application to recommend to a user, wherein an app store can be understood as an application download platform, etc.

[0051] It should be noted that the method provided in the embodiments of this application can also be used in many other application scenarios to determine at least one item to recommend to the user. The examples here are only for the convenience of understanding this solution and do not exhaustively list all application scenarios.

[0052] To facilitate understanding, before introducing the methods provided in the embodiments of this application, some technical terms involved in this application will be introduced first.

[0053] (1) Generative Model

[0054] Generative models are used to infer results based on given input information. The input information of a generative model can also be replaced by a reasoning request. The input information can include text, images, audio, or video, depending on the specific circumstances. In this embodiment, a generative model is applied to a recommendation scenario to determine at least one recommended item. In this embodiment, the input information of the generative model often includes text.

[0055] Optionally, the generative model in this embodiment is specifically a large generative model, such as a large language model (LLM). A large model refers to a model with a large number of parameters and a complex computational structure. These models are typically constructed from deep neural networks and have billions or even hundreds of billions of parameters.

[0056] In some embodiments, generative models are based on a transformer architecture. Of course, generative models can also be based on other architectures, such as models based on the Mamba architecture.

[0057] (2) Token

[0058] In the field of AI technology, especially in natural language processing (NLP), a token typically refers to the smallest unit or basic element in the text processing process. A token can be a word, a phrase, a punctuation mark, a subword, or a character, depending on the specific application scenario.

[0059] (3) Key-value pairs (KV)

[0060] Generative models employing the transformer architecture include at least an attention-based neural network layer, which utilizes key-value pairs (KV) during processing. Optionally, the model may also include a feed-forward neural network (FFN) layer, or other neural network layers, depending on the specific application scenario.

[0061] For example, the KV in the embodiments of this application can be understood as a KV tensor. Here, a tensor is a form of data storage, and the dimension of the data is called the order of the tensor. A tensor can be viewed as a generalization of vectors and matrices in a multidimensional space; that is, a vector can be viewed as a one-dimensional tensor, and a matrix can be viewed as a two-dimensional tensor.

[0062] Currently, generative models can be used to determine at least one recommended item in various recommendation scenarios. However, since generative models use a token-based generation mechanism to determine recommended items, each inference process of the generative model consumes a large amount of computer resources. To solve the aforementioned problem, this application discloses that after obtaining the input information of the generative model, it can be determined that the input information includes user data and an item set, the item set including multiple candidate items. The multiple items in the aforementioned item set are divided into multiple subsets, each of which includes at least one item. The user data and each subset are used to obtain evaluation information of at least one item in each subset through the generative model. Then, based on the evaluation information of at least one item in the multiple subsets, at least one recommended item is determined from the item set.

[0063] Because the input tokens for each inference process of a generative model include user data and all candidate items, and each candidate item often includes multiple tokens, each inference process consumes a significant amount of computing resources. However, researchers have found that the evaluation information of different items is often independent. For example, if multiple candidate items include item 1 and item 2, the evaluation information of item 2 obtained through the generative model often does not need to consider item 1. Based on this idea, in this embodiment, the multiple candidate items included in the item set are divided into multiple subsets, each subset including at least one item. User data and each subset are used to obtain the evaluation information of at least one item in each subset through the generative model. Then, based on the evaluation information of at least one item in each subset, at least one recommended item is determined from the item set. In other words, instead of treating user data and all candidate items as a whole, all candidate items are split. Therefore, each inference process of the generative model no longer needs to include all candidate items, which helps to reduce the computing resources consumed in each inference process.

[0064] For example, in one case, the execution entity of the method provided in this application embodiment is the same processor, for example, the aforementioned processor is a central processing unit (CPU). In more detail, the operations of obtaining input information for the generative model, splitting multiple items in the item set into multiple subsets, obtaining evaluation information for at least one item in each subset through the generative model, and determining at least one recommended item can all be executed by the same processor.

[0065] In another scenario, the execution entity of the method provided in this application embodiment is an inference system, which includes a processor and accelerators. For example, the operations described above—obtaining input information from a generative model, splitting multiple items in the item set into multiple subsets, and determining at least one recommended item—can all be performed by a processor. The operation described above—obtaining evaluation information for at least one item in each subset through the generative model—is performed by at least one accelerator. To more intuitively understand this solution, please refer to Figure 1. Figure 1 is a schematic diagram of an inference system provided in this application embodiment. As shown in Figure 1, the inference system includes a central processing unit (CPU) and N accelerators, where N is an integer greater than 1. It should be understood that the example in Figure 1 is only for the convenience of understanding this solution and is not intended to limit this solution.

[0066] The term "accelerator" can also be replaced by "acceleration card," "acceleration device," or "acceleration chip." For example, an accelerator can be a hardware accelerator such as an embedded neural network processing unit (NPU), a graphics processing unit (GPU), an application-specific integrated circuit (ASIC), or a field-programmable gate array (FPGA).

[0067] Optionally, the processor and accelerator described above may be contained within the same physical server; or, the processor and accelerator may be contained within the same super pod. For example, a super pod may include one or more physical servers, and when a super pod includes multiple physical servers, these servers can communicate at high speed; for instance, a super pod may appear as a large server. The processor and accelerator may be deployed within the same physical server or different physical servers included in the same super pod. Alternatively, the processor and accelerator may be contained within different physical servers, which are not located within the same super pod.

[0068] It should be noted that in the specific embodiments of this application, user data and other related data are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0069] Based on the above description, please refer to Figure 2, which is a flowchart of a reasoning method provided in this application. The reasoning method shown in Figure 2 includes the following steps 201 to 207.

[0070] 201. Receive recommendation requests.

[0071] Step 201 is optional. In one implementation, step 201 includes: a first device receiving a first recommendation request from a second device, the first recommendation request including user data and an item set, the item set including multiple candidate items (hereinafter referred to as "first item" for convenience), the first recommendation request being used to request the determination of at least one recommended item from the item set.

[0072] For example, the first device is a physical server or a supernode, and step 201 is executed by the processor in the first device. The second device is another physical server other than the first device, or another supernode other than the first device, etc. The specific product form of the second device can be determined in combination with the actual application scenario.

[0073] Before executing step 201, during the use of the user device, the user inputs a first operation into the user device, and correspondingly, the user device receives the first operation input by the user. In response to the received first operation, the user device sends a second recommendation request to the second device, and correspondingly, the second device receives the second recommendation request from the user device. For example, the user device can be a smartphone, laptop, desktop computer, augmented reality terminal, tablet computer, e-book reader, laptop computer, or IoT device, etc. The product form of the user device can be determined based on the actual application scenario, and this application embodiment does not exhaustively list them.

[0074] For example, the first operation can be a swipe operation input by the user through the display interface of the user device. For instance, when using the aforementioned shopping platform, music platform, or video platform, the user can request new item recommendations by inputting a swipe operation. Alternatively, the display interface of the user device may have an icon for receiving the first operation, and the first operation is a click operation on the aforementioned icon. Alternatively, the first operation can also be a voice command input by the user via voice, etc. The specific implementation of the first operation can be determined in conjunction with the specific application scenario.

[0075] The second recommendation request includes at least a user identifier (ID), which is used to request the second device to determine at least one item to recommend to the user. Optionally, the second recommendation request also includes at least one attribute, such as: user age, user gender, geographical location of the second recommendation request, time of the second recommendation request, model of the device that issued the second recommendation request, or other information, etc., which are not exhaustively listed in this embodiment.

[0076] After receiving the second recommendation request, the second device can obtain user data. For example, the second device obtains at least one piece of the user's historical behavior data based on the user ID obtained from the second recommendation request, each piece of historical behavior data indicating at least one action performed by the user on an entry. The user data includes at least one piece of the user's historical behavior data. Optionally, the user data also includes at least one of the following: user ID, user age, user gender, geographical location of the second recommendation request, time of the second recommendation request, model of the device that issued the second recommendation request, or other information obtained from the second recommendation request.

[0077] For example, at least one historical behavior data in the user data can be the user's historical behavior data within a preset period of time before the current moment, such as one month, 15 days, two weeks, one week or other durations, etc., which is not limited in this application embodiment.

[0078] For example, each piece of historical behavior data includes an identifier for an entry and at least one action performed by the user on that entry. For instance, at least one action may include at least one of the following: clicking, saving, liking, disliking, forwarding, purchasing, watching, browsing, commenting, or other actions, depending on the specific application scenario.

[0079] Optionally, each historical behavior data may also include at least one of the following: the geographical location where the user performed the behavior on the item, the time when the user performed the behavior on the item, the model or other attribute information of the device used by the user to perform the behavior on the item, etc.

[0080] Optionally, each historical behavior data point may also include attribute information for that entry. For example, if an entry is a video, the video's attributes would include at least one of the following: whether the video is long or short, its geographic region, the type of video content, or other attribute information. As another example, if an entry is a product, the product's attributes would include at least one of the following: product price, product category, or other attribute information. It should be noted that these examples are for illustrative purposes only and are not intended to limit the scope of this solution.

[0081] To gain a more intuitive understanding of this solution, please refer to Figure 3. Figure 3 is a schematic diagram of multiple historical behavior data provided in an embodiment of this application. Figure 3 shows six historical behavior data entries, with the entry type being video. Each historical behavior data entry includes a video ID and at least one behavior. The behavior types shown in Figure 3 include watching, favorited, disliked, liked, and searched. It should be understood that the example in Figure 3 is only for the convenience of understanding this solution and is not intended to limit this solution.

[0082] In this application embodiment, the components of user data are clearly defined, improving the feasibility of the solution. Furthermore, the historical behavior data included in the user data indicates at least one behavior performed by the user on an item. Therefore, the user data can reflect the user's preferences for items, which is beneficial for identifying items that better match the user's preferences based on historical behavior data. In other words, it facilitates recommending items that the user likes to the user, thereby improving the user experience of this solution.

[0083] After receiving the second recommendation request, the second device can obtain multiple candidate first entries (i.e., a set of entries). Optionally, the second device stores multiple entries in its database. Exemplarily, each entry in the database includes at least an entry ID; optionally, each entry in the database may also include the entry's attribute information. Based on at least one piece of the user's historical behavior data and at least one piece of attribute information obtained from the second recommendation request, the second device performs feature extraction operations through a machine learning model to obtain user features. For example, the machine learning model is an attention-based neural network, a recurrent neural network, a fully connected neural network, a residual neural network, or other types of neural network layers. Based on the user features, the second device selects multiple candidate first entries from the multiple entries stored in the database.

[0084] For example, in one implementation of the second device acquiring user features, the second device treats at least one historical behavior data of the user and at least one attribute information obtained from the second recommendation request as a whole, and uses a machine learning model to extract features from the aforementioned whole to obtain user features.

[0085] In another implementation, illustrated in Figure 4, which is a schematic diagram of generating user features using a machine learning model according to an embodiment of this application. Taking video as an example, Figure 4 shows that at least one historical behavior data of the user is divided into two categories: multiple first historical behavior data corresponding to multiple video viewing behaviors of the user, and multiple second historical behavior data corresponding to multiple video search behaviors of the user. The second device vectorizes each first historical behavior data to obtain multiple tokens corresponding to each first historical behavior data; based on the tokens corresponding to all first historical behavior data, an average is calculated to obtain the historical viewing behavior features corresponding to the multiple first historical behavior data. Similarly, the second device vectorizes each second historical behavior data to obtain multiple tokens corresponding to each second historical behavior data; based on the tokens corresponding to all second historical behavior data, an average is calculated to obtain the historical search behavior features corresponding to the multiple second historical behavior data. The second device also vectorizes at least one attribute information obtained from the second recommendation request (i.e., the geographical location, user age, and user gender of the user who issued the second recommendation request, as shown in Figure 4) to obtain a token corresponding to each of the aforementioned at least one attribute information. The second device concatenates the historical viewing behavior features, historical search behavior features, and the token corresponding to each attribute information to obtain a first feature. The second device updates the aforementioned first feature through multiple neural network layers to obtain a second feature. The second device further processes the second feature through a normalized exponential function (softmax) layer to obtain a third feature. The second device fuses the second feature and the third feature to obtain the user feature. It should be understood that the example in Figure 4 is only for the convenience of understanding this scheme and is not intended to limit this scheme.

[0086] Regarding the specific implementation of the second device acquiring multiple candidate first entries, optionally, the database of the second device not only stores multiple entries but also stores the features of each entry, where the features of each entry are obtained by feature extraction from each entry using a machine learning model. The second device calculates a first similarity between the user features and the features of each entry, and based on the first similarity between the user features and the features of each entry, selects multiple entries from the multiple entries stored in the database, thereby obtaining multiple first entries in the entry set; for example, the second device determines the entries that satisfy the first similarity condition from the multiple entries stored in the database as the selected multiple entries.

[0087] For example, the first similarity condition is that the first similarity between the user's features and the features of the entry is greater than or equal to a similarity threshold; another example is that the first similarity condition is to select a preset number of entries with the highest first similarity from multiple entries stored in the database. Alternatively, other conditions may be used for the first similarity condition, which are not exhaustively listed in this embodiment.

[0088] Alternatively, the second device may not perform feature extraction based on at least one historical behavioral data of the user and at least one attribute information obtained from the second recommendation request. Instead, it may directly calculate the second similarity between the user data and each entry in the database, and select multiple entries from the multiple entries stored in the database based on the second similarity between the user data and each entry in the database, thereby obtaining multiple first entries in the entry set. For example, the second device determines the multiple entries that meet the second similarity condition from the multiple entries stored in the database as the selected multiple entries.

[0089] For example, the second similarity condition is that the second similarity between user data and entries is greater than or equal to a similarity threshold; another example is that the second similarity condition is to select a preset number of entries with the highest second similarity from multiple entries stored in the database. Alternatively, other conditions may be used for the second similarity condition, which are not exhaustively listed in this embodiment.

[0090] It should be noted that the information contained in "the entries stored in the database" and "the first entry in the entry set" can be the same or different. Optionally, the entries stored in the database include not only the entry ID but also the entry's attribute information. Each first entry in the entry set can include only the entry ID. In other words, after selecting multiple entries from the multiple entries stored in the database, only the ID of each selected entry can be added to the entry set. This helps to further reduce the amount of data that the generative model needs to process and further reduce the latency of obtaining the evaluation information of the entries through the generative model, thereby improving the efficiency of determining at least one recommended entry.

[0091] In another implementation, step 201 includes: the first device receiving a second recommendation request from the user device. The meaning of the second recommendation request can be found in the above description and will not be elaborated here.

[0092] 202. Obtain the input information for the generative model. The input information includes user data and a set of entries. The set of entries includes multiple candidate first entries.

[0093] Since step 201 is optional, if step 201 is executed, step 202 may include: the first device determining user data and a set of items based on the received recommendation request, and then determining the input information of the generative model. The input information of the generative model may also be replaced by an inference request for the generative model, and the input information of the generative model includes user data and a set of items. Optionally, the input information of the generative model may also include a prompt. Exemplarily, step 202 is executed by a processor in the first device.

[0094] Furthermore, in one implementation, if in step 201 the first device receives a first recommendation request from the second device, the first recommendation request including user data and a set of items, then in step 202, the first device obtains the user data and the set of items from the received first recommendation request, and then determines the input information of the generative model. In this embodiment, after receiving the recommendation request, in order to determine the recommended items in response to the received recommendation request, the determined recommended items will be displayed to the user. That is to say, the computer resources consumed in the process of determining the recommended items are effectively consumed, avoiding the waste of computer resources.

[0095] In another implementation, if the first device receives a second recommendation request from the user device in step 201, then in step 202, the first device obtains user data and a set of entries based on the received second recommendation request. The specific implementation of the aforementioned steps can be found in the description of step 201 above, except that "second device" is replaced with "first device" in the description; this will not be elaborated further here. After obtaining the user data and the set of entries, the first device determines the input information for the generative model.

[0096] Alternatively, if step 201 is not performed, step 202 may include: the first device actively acquiring user data and a set of entries based on the user ID, and then determining the input information for the generative model. For example, the first device can acquire the user ID of at least one online user, and acquire user data and a set of entries based on the user ID of each online user. In other words, at least one recommended entry can be determined not only by responding to a received recommendation request, but also by actively determining at least one recommended entry.

[0097] 203. Generate key-value pairs (KV) for user data.

[0098] Step 203 is an optional step. Optionally, if the input information of the generative model also includes prompts, then in step 203, the key-value pair of the prompts can also be generated. Exemplarily, step 203 is executed by the processor in the first device.

[0099] Optionally, in one implementation, step 203 includes: the first device generating key-value pairs (KV) of user data (optionally including prompts) through a generative model. For example, the first device embeds the user data (optionally including prompts) to obtain multiple tokens, and the first device inputs the aforementioned multiple tokens step by step into the generative model to generate KV of user data (optionally including prompts) through the generative model.

[0100] Alternatively, in one implementation, step 203 includes: the first device acquiring initial features of user data (optionally including prompts), transforming the initial features of the user data using a first matrix to obtain the key (K) of the user data (optionally including prompts), and transforming the initial features of the user data using a second matrix to obtain the value (V) of the user data (optionally including prompts), i.e., obtaining the KV of the user data (optionally including prompts). Further, in one case, the initial features of the user data and the user features in the above steps are the same concept; in this case, the specific implementation of the first device acquiring the initial features of the user data can be found in the above description and will not be elaborated here. In another case, the first device uses a recurrent neural network to extract features from the user data (optionally including prompts) to obtain the initial features of the user data (optionally including prompts); the aforementioned recurrent neural network can also be replaced by a fully connected neural network, a residual neural network, or other types of neural networks, etc., which will not be exhaustively listed here.

[0101] 204. Divide the set of entries into multiple subsets, each subset including at least one first entry, wherein the user data and each subset are used to obtain evaluation information of at least one first entry in each subset through a generative model.

[0102] For example, the first device divides the candidate first entries included in the entry set into multiple subsets, each subset including at least one first entry, and the first device does not segment the user data. Then, the user data (optionally including prompts) and each subset are used to obtain evaluation information for at least one first entry in each subset through a generative model. For example, step 204 is executed by a processor in the first device.

[0103] To more intuitively understand this solution, please refer to Figure 5, which is a schematic diagram of processing the input information of a generative model according to an embodiment of this application. As shown in Figure 5, the input information of the generative model includes user data and an item set. The user data includes multiple historical behavior data, each of which includes an item ID and a behavior. The item set includes multiple item IDs. When using the inference method provided in this embodiment, without segmenting the user data, the multiple item IDs of the item set are segmented to obtain multiple subsets, each of which includes at least one item ID. It should be understood that the example in Figure 5 is only for the convenience of understanding this solution and is not intended to limit this solution.

[0104] Furthermore, in one case, the operation of obtaining evaluation information for at least one first entry in each subset through a generative model is performed by the processor of the first device. In another case, the operation of obtaining evaluation information for at least one first entry in each subset through a generative model is performed by N accelerators outside the processor. Here, N is an integer greater than or equal to 1, and optionally, N is greater than 1.

[0105] For example, in one implementation, the number of entries included in each subset is preset; in other words, the upper limit of the number of entries included in each subset is a first number. Step 204 includes: the first device dividing the candidate first entries included in the entry set into multiple subsets according to the preset first number.

[0106] In another implementation, the number of subsets is preset; in other words, the number of multiple subsets is a preset second number. Step 204 may include: the first device dividing the multiple candidate first entries included in the entry set into a second number of subsets.

[0107] The partitioning strategy adopted by the first device can be average allocation, random allocation, or other allocation methods. If the operation of obtaining the evaluation information of at least one first item in each subset through the generative model is performed by N accelerators other than the processor, optionally, the first device can also, based on the idea of ​​load balancing, divide the candidate first items included in the item set into a second number of subsets according to the current computer resource usage of each of the N accelerators.

[0108] If the operation of obtaining evaluation information for at least one first item in each subset through a generative model is performed by N accelerators other than the processor, optionally, the second number is N. For example, step 204 includes: the first device dividing the set of items into N subsets corresponding one-to-one with the N accelerators.

[0109] 205. Send the first data and subset to the accelerator. The first data is obtained based on the user data.

[0110] Step 205 is optional. If the operation of obtaining the evaluation information of at least one first item in each subset through the generative model is performed by the processor of the first device, then step 205 is not required. If the operation of obtaining the evaluation information of at least one first item in each subset through the generative model is performed by N accelerators other than the processor, then step 205 is required.

[0111] The first data is obtained based on user data. For example, if step 203 is executed, the first data includes the key-value pairs (KVs) of the user data; that is, the evaluation information of at least one first item in each subset is obtained by reasoning using a generative model based on the KVs of the user data (optionally, also including the KVs of the prompts) and each subset. If step 203 is not executed, the first data includes the user data; that is, the evaluation information of at least one first item in each subset is obtained by reasoning using a generative model based on the user data (optionally, also including the prompts) and each subset.

[0112] It should be noted that if the input information of the generative model also includes a cue, then the cue is not segmented. The key-value pairs of the cue, the key-value pairs of the user data, and all first entries included in a subset are treated as a whole and used for inference through the generative model. Alternatively, the cue, the user data, and all first entries included in a subset are treated as a whole and used for inference through the generative model. In the following description, only the example of the generative model's input information including user data and a set of entries will be used for illustration, and the cue will no longer be emphasized.

[0113] Optionally, if in step 204 the first device generates N subsets corresponding one-to-one with the N accelerators, in step 205, the first device sends first data and a subset to each of the N accelerators.

[0114] Alternatively, if the number of subsets generated by the first device in step 204 is greater than N, then the first device may also send more than one subset to some accelerators. The specific situation can be determined in combination with the actual application scenario.

[0115] Optionally, if the processor of the first device and the N accelerators are contained within the same physical server, then the transmission operation of the first data and a subset is performed within the server (i.e., within the device). If the processor of the first device and the N accelerators are contained within the same supernode, then the transmission operation of the first data and a subset is implemented using the high-speed communication network within the same supernode.

[0116] Alternatively, if the processor of the first device and the N accelerators belong to different physical servers, and the aforementioned different physical servers do not belong to the same supernode, then the transmission operation of the first data and a subset is performed between different devices.

[0117] 206. Obtain the evaluation information of at least one first entry in multiple subsets.

[0118] For example, the evaluation information of the first item is expressed as a score or rating, which can be set according to the actual application scenario.

[0119] For example, in one case, the operation of generating evaluation information for at least one first item in each subset through a generative model is performed by N accelerators; in another case, the operation of generating evaluation information for at least one first item in each subset through a generative model is performed by the processor of the first device. Since the processing procedures for the two cases are different, they will be described separately below.

[0120] The operation of generating evaluation information for at least one first entry in each subset using a generative model is performed by N accelerators.

[0121] If N is an integer greater than 1, optionally, the operation of obtaining the evaluation information of the first item in multiple subsets through the generative model is executed in parallel by multiple accelerators. In other words, N accelerators execute the generation operation of evaluation information of at least one first item in each subset in parallel through the generative model. To understand this scheme more intuitively, please refer to Figure 6, which is a schematic diagram of parallel inference through multiple accelerators provided by an embodiment of this application. In Figure 6, taking N accelerators as 8 GPUs as an example, the set of items is divided into 8 subsets corresponding one-to-one with the 8 GPUs. Each of the 8 subsets includes multiple item IDs. The key-value pairs of the user data and each of the 8 subsets are sent to one GPU, and the 8 GPUs perform parallel inference. Each GPU treats the key-value pairs of the user data and all item IDs in a subset as a whole and performs inference using the generative model. It should be understood that the example in Figure 6 is only for the convenience of understanding this scheme and is not intended to limit this scheme.

[0122] Optionally, if the first data includes key-value pairs (KV) of user data, then each of the N accelerators receives the KV of user data and at least one subset. The accelerator can then treat the KV of user data and the subset as a whole for reasoning. If an accelerator receives two or more subsets, it can process each subset individually. For example, regarding the specific implementation of the accelerator processing each subset, the accelerator vectorizes at least one first item in a subset to obtain a token corresponding to that first item. The accelerator inputs the KV of user data and the token corresponding to the at least one first item in a subset into the generative model, and generates evaluation information for each first item in the aforementioned subset in a token-by-token manner.

[0123] To more intuitively understand this solution, please refer to Figure 7, which is another schematic diagram of parallel inference using multiple accelerators provided in an embodiment of this application. Figure 7 uses N accelerators, including 3 NPUs, as an example. The CPU obtains the input information of the generative model, which includes user data and an item set. The CPU vectorizes the user data to obtain multiple tokens corresponding to the user data. Based on these tokens, the CPU generates initial features of the user data through the generative model. The CPU divides the item set into three subsets, sends the key-value pairs of the user data to each NPU, and sends each of the three subsets to one NPU, thus enabling parallel inference by the three NPUs. As shown in Figure 7, after obtaining a subset, each NPU vectorizes it to obtain multiple tokens corresponding to that subset. Each NPU, based on the key-value pairs of the user data and the multiple tokens corresponding to a subset, performs inference through the generative model to obtain the evaluation information for each first item in the subset. It should be understood that the example in Figure 7 is only for ease of understanding and is not intended to limit this solution.

[0124] Alternatively, if the first data includes user data, then each of the N accelerators receives user data and at least one subset. The accelerator can then treat the user data and the subset as a whole for reasoning. If an accelerator receives two or more subsets, it can process each subset individually. For example, regarding the specific implementation of the accelerator processing each subset, the accelerator vectorizes at least one first item in a subset to obtain a token corresponding to that first item. The accelerator inputs the user data and the token corresponding to the at least one first item in a subset into the generative model, generating evaluation information for each first item in the aforementioned subset on a token-by-token basis.

[0125] After obtaining the evaluation information of all first entries in each subset through a generative model, in one implementation, each of the N accelerators sends the evaluation information of all first entries in each subset to the processor of the first device. Correspondingly, step 206 includes: the processor of the first device receiving the evaluation information of all first entries in multiple subsets.

[0126] In another implementation, each of the N accelerators, after obtaining evaluation information for all first entries in at least one subset through a generative model, filters at least one first entry in each subset according to filtering criteria based on the evaluation information of each first entry in the at least one subset. If an accelerator determines that at least one first entry in at least one subset does not meet the filtering criteria, this means that the accelerator has obtained at least one filtered first entry after performing the filtering operation on the subset, and the accelerator sends the evaluation information of each of the at least one filtered first entry to the processor of the first device. If an accelerator determines that all first entries in at least one subset do not meet the filtering criteria, this means that the accelerator has obtained 0 filtered first entries after performing the filtering operation on the subset, and the accelerator may not send evaluation information to the processor of the first device.

[0127] For example, the filtering condition could be that the score of the first item is greater than or equal to a preset score, or that the rating of the first item is greater than or equal to a preset level. Another example is that the filtering condition could be to select a preset number of items with the highest scores from all first items included in at least one subset, or that the filtering condition could be to select a preset number of items with the highest ratings from all first items included in at least one subset. The specific content of the filtering conditions can be determined based on the actual application scenario.

[0128] Step 206 includes: the processor of the first device receiving evaluation information of at least one first entry from a plurality of subsets, wherein the evaluation information of at least one first entry from a plurality of subsets comes from at least one accelerator from a plurality of N accelerators.

[0129] In this embodiment, splitting the entire item set into multiple subsets means that the large task of generating evaluation information for all candidate items in the item set is broken down into multiple smaller tasks. The operation of obtaining evaluation information for recommended items in multiple subsets through the generative model is executed in parallel by multiple accelerators. This means that multiple accelerators execute multiple smaller tasks in parallel, which helps to obtain the required evaluation information more quickly, thus determining the recommended items faster and significantly reducing the latency of the recommended item determination process. Furthermore, since the generative model relies on user data and the item itself when generating evaluation information for a particular item, and the evaluation information of different items is often independent, this method of splitting the item set only, without splitting the user data, allows each accelerator to obtain complete user data and at least one item. Each accelerator can then independently generate evaluation information for the item based on the obtained data. In other words, each accelerator does not need to interact with other accelerators during the process of generating evaluation information for the item, thus avoiding the introduction of additional communication overhead.

[0130] Optionally, the item set is divided into N subsets corresponding one-to-one with N accelerators, and one subset is sent to each accelerator. In this way, each accelerator is used to generate evaluation information for the items in one subset. The N accelerators perform parallel inference to generate evaluation information for the items in the N subsets in parallel, providing a simple and easy-to-implement segmentation method.

[0131] Optionally, if the processor and N accelerators are contained within the same server, this means that communication between the processor and the N accelerators occurs within the same physical server, ensuring high communication speed. Alternatively, if the processor and N accelerators are contained within the same supernode, this means that communication between the processor and the N accelerators utilizes the high-speed communication network within the supernode, also guaranteeing high communication speed. Both architectures help reduce the latency of the overall process for determining recommended items and improve the efficiency of the overall process for determining recommended items.

[0132] Second, the operation of generating evaluation information for at least one first entry in each subset through a generative model is performed by the processor.

[0133] For example, step 206 includes: the processor of the first device generating evaluation information for at least one first entry in a plurality of subsets.

[0134] Furthermore, if step 203 is executed, then in step 206, the processor of the first device can treat the KV of the user data and a subset as a whole for reasoning, and process each subset one by one to obtain the evaluation information of at least one first entry in multiple subsets.

[0135] Regarding the specific implementation process of the processor of the first device processing each subset, the processor of the first device vectorizes at least one first item in a subset to obtain a token corresponding to at least one first item in a subset. The processor of the first device inputs the key-value pairs of the user data and the token corresponding to at least one first item in a subset into the generative model, and generates the evaluation information of each first item in the aforementioned subset one by one in the form of token-by-token.

[0136] If step 203 is not executed, then in step 206, the processor of the first device can treat the user data and a subset as a whole for reasoning, and process each subset one by one to obtain evaluation information of at least one first entry in multiple subsets.

[0137] Regarding the specific implementation process of the processor of the first device processing each subset, the processor of the first device vectorizes at least one first item in a subset to obtain a token corresponding to at least one first item in a subset. The processor of the first device inputs user data and the token corresponding to at least one first item in a subset into the generative model, and generates evaluation information for each first item in the aforementioned subset one by one in a token-by-token manner.

[0138] In this embodiment of the application, if the key-value pairs (KVs) of user data are generated in advance, then the generated KVs of user data can be directly reused in each inference process. Therefore, it is not necessary to regenerate the KVs of user data in each inference process. This not only helps to further reduce the computer resources consumed in each inference process, but also helps to improve the speed of generating evaluation information of items through generative models, thereby reducing the latency of the process of determining recommended items.

[0139] 207. Based on the evaluation information of at least one first item in multiple subsets, determine at least one recommended item from the item set.

[0140] For example, after the processor of the first device obtains the evaluation information of at least one first item in multiple subsets, it can sort the aforementioned at least one first item according to the score (or rating) of each first item in descending order of score (or rating), select at least one item with the highest score (or rating) from the aforementioned at least one first item (hereinafter referred to as "second item" for easy distinction), and the selected at least one second item is used as the recommended at least one item determined from the item set.

[0141] Optionally, after obtaining the evaluation information of at least one first item from multiple subsets, the processor of the first device can further determine whether the number of the aforementioned at least one first item is less than or equal to a first quantity. If the number of the aforementioned at least one first item is less than or equal to the first quantity, the processor of the first device can determine the aforementioned at least one first item as the recommended at least one item. If the number of the aforementioned at least one first item is greater than the first quantity, selection is then made based on the evaluation information of at least one first item from multiple subsets. For example, the first quantity is 1, 2, 3, 4, 5, or other values.

[0142] To more intuitively understand this solution, please refer to Figure 8, which is another flowchart illustrating the inference method provided in this application embodiment. As shown in Figure 8, in step 801, the CPU obtains input information for the generative model, including user data and an item set, where the item set includes multiple candidate items. In step 802, the CPU divides the item set into multiple subsets, each of which includes at least one item. The user data and each subset are used to obtain evaluation information for at least one item in each subset through the generative model. In step 803, the CPU sends first data and at least one item from a subset to each of the N accelerators, the first data being obtained based on the user data. In step 804, each accelerator obtains evaluation information for at least one item in that subset based on the first data and at least one item from the subset through the generative model. In step 805, some of the N accelerators send evaluation information for at least one item in a subset to the CPU. Correspondingly, the CPU receives evaluation information for at least one item in multiple subsets. It should be noted that since some accelerators may determine that none of the items in a subset meet the filtering criteria based on the evaluation information of all items in that subset, some of the N accelerators may not send any evaluation information to the CPU. In step 806, the CPU determines at least one recommended item from the item set based on the evaluation information of at least one item in multiple subsets. The detailed implementation of the steps in Figure 8 can be found in the above description and will not be elaborated here. It should be understood that the example in Figure 8 is only for the convenience of understanding this scheme and is not intended to limit this scheme.

[0143] In this embodiment, since the input token for each inference process of the generative model includes user data and all candidate items, and all candidate items often include multiple tokens, each inference process requires a large amount of computing resources. However, researchers have found that the evaluation information of different items is often independent. For example, if multiple candidate items include item 1 and item 2, when obtaining the evaluation information of item 2 through the generative model, item 1 is often not considered. Based on this idea, in this implementation, the multiple candidate items included in the item set are divided into multiple subsets, each subset including at least one item. User data and each subset are used to obtain the evaluation information of at least one item in each subset through the generative model. Then, based on the evaluation information of at least one item in each subset, at least one recommended item is determined from the item set. In other words, instead of treating user data and all candidate items as a whole, all candidate items are split. Therefore, each inference process of the generative model no longer needs to include all candidate items, which helps to reduce the computing resources consumed in each inference process.

[0144] To provide a more intuitive understanding of the beneficial effects of the method provided in this application, the experimental data in Table 1 below will be used as a reference.

[0145] Table 1

[0146] In this context, the reference group refers to treating the input information of the generative model as a whole and using the generative model to infer the evaluation information of the items. As shown in Table 1, when the generative model has 1B parameters, if the reference group method is used to determine the evaluation information of the items and then the recommended items, the latency of one operation is 22.2ms; if the method provided in this application is used to determine the evaluation information of the items and then the recommended items through parallel inference using 4 accelerators, the latency of one operation is 5.5ms. When the generative model has 10B parameters, if the reference group method is used to determine the evaluation information of the items and then the recommended items, the latency of one operation is 494ms; if the method provided in this application is used to determine the evaluation information of the items and then the recommended items through parallel inference using 64 accelerators, the latency of one operation is 7.2ms. Experimental data show that the method provided in this application can significantly reduce the latency of determining recommended items.

[0147] Based on the embodiments corresponding to Figures 1 to 8, related equipment for implementing the above solutions is also provided below. Specifically, refer to Figure 9, which is a schematic diagram of a reasoning device provided in an embodiment of this application. The reasoning device 900 includes: an acquisition unit 901, used to acquire input information of a generative model, the input information including user data and an item set, the item set including multiple candidate items;

[0148] The processing unit 902 is used to divide the item set into multiple subsets, each subset including at least one item, wherein the user data and each subset are used to obtain evaluation information of at least one item in each subset through a generative model; the processing unit 902 is also used to determine at least one recommended item from the item set based on the evaluation information of at least one item in the multiple subsets.

[0149] Optionally, the operation of obtaining evaluation information of items in multiple subsets through generative models is performed in parallel by multiple accelerators.

[0150] Optionally, the multiple accelerators include N accelerators, where N is an integer greater than 10. The processing unit 902 is specifically used to divide the set of entries into N subsets, and the N subsets correspond one-to-one with the N accelerators. The inference device 900 also includes a transceiver unit 903, which is used to send a subset to each of the N accelerators.

[0151] Optionally, the execution entity of the device is a processor, and the processor and multiple accelerators are contained within the same server, or the processor and multiple accelerators are contained within the same supernode.

[0152] Optionally, the processing unit 902 is also used to generate key-value pairs (KV) of the user data, and the KV of the user data and each subset are used to obtain evaluation information for at least one item in each subset through a generative model.

[0153] Optionally, the user data includes at least one historical behavior data of the user, which indicates at least one behavior performed by the user on an entry.

[0154] Optionally, the inference device 900 further includes: a transceiver unit 903 for receiving a recommendation request, the recommendation request including user data and a set of items; and an acquisition unit 901, specifically used to determine the input information of the generative model based on the recommendation request.

[0155] It should be noted that the information interaction and execution process between the modules / units in the inference device 900 are based on the same concept as the various method embodiments corresponding to Figures 1 to 8 in this application. For details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.

[0156] Referring to Figure 10, which is a schematic diagram of another structure of the inference device provided in an embodiment of this application, the inference device 1000 is used in a scenario using a generative model. The input information of the generative model includes user data and an item set. The item set includes multiple candidate items. The inference device 1000 includes: a transceiver unit 1001, used to receive first data and at least one item sent by a processor, wherein the first data is obtained based on user data, the item set includes multiple subsets, and the received at least one item belongs to a first subset among the multiple subsets; a processing unit 1002, used to obtain evaluation information of at least one item in the first subset through a generative model based on the first data and at least one item in the first subset; the transceiver unit 1001 is also used to send the evaluation information of at least one item in the first subset to the processor, wherein the evaluation information of at least one item in the multiple subsets is used for the processor to determine at least one recommended item from the item set.

[0157] Optionally, the first data is the key-value pair (KV) of the user data.

[0158] It should be noted that the information interaction and execution process between the modules / units in the inference device 1000 are based on the same concept as the various method embodiments corresponding to Figures 1 to 8 in this application. For details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.

[0159] The following describes a device provided in an embodiment of this application. Please refer to Figure 11, which is a schematic diagram of the structure of the device provided in an embodiment of this application. Optionally, device 1100 performs the function of the first device in the various method embodiments corresponding to Figures 1 to 8. Alternatively, device 1100 performs the function of the accelerator in the various method embodiments corresponding to Figures 1 to 8.

[0160] Device 1100 includes a memory 1102 and at least one processor 1101. Optionally, device 1100 further includes at least one accelerator 1103. Optionally, processor 1101 implements the method in the above embodiments by reading program instructions stored in memory 1102; or, processor 1101 reads program instructions stored in memory 1102 and implements the steps executed by the machine learning model in the method in the above embodiments through accelerator 1103; or, processor 1101 may also implement the method in the above embodiments by reading program instructions stored internally; or, processor 1101 may also read program instructions stored internally and implement the steps executed by the machine learning model in the method in the above embodiments through accelerator 1103.

[0161] When the processor 1101 reads the program instructions stored in the memory 1102 to implement the method in the above embodiments, the memory 1102 stores the program instructions that implement the method provided in the above embodiments of this application.

[0162] Optionally, at least one processor 1101 is one or more CPUs, either a single-core CPU or a multi-core CPU. For example, memory 1102 includes, but is not limited to, random access memory (RAM), read-only memory (ROM), flash memory, or optical memory. Memory 1102 stores program instructions for the operating system. For example, at least one accelerator 1103 may include at least one of the following: GPU, NPU, TPU, ASIC, FPGA, or other types of accelerators. After the program instructions stored in memory 1102 are read by the at least one processor 1101, device 1100 executes the corresponding operations in the foregoing embodiments.

[0163] Optionally, the device 1100 also includes a network interface 1104, which can be a wired interface or a wireless interface. The network interface 1104 is used to perform data transmission and reception in the various method embodiments corresponding to Figures 1 to 8.

[0164] It should be understood that network interface 1104 has the functions of receiving and sending data. The functions of "receiving data" and "sending data" can be integrated into the same transceiver interface, or the functions of "receiving data" and "sending data" can be implemented in different interfaces, which is not limited here. In other words, network interface 1104 may include one or more interfaces for implementing the functions of "receiving data" and "sending data".

[0165] After the processor 1101 reads the program instructions from the memory 1102, other functions that the device 1100 can perform are described in the preceding method embodiments.

[0166] Optionally, the device 1100 also includes a bus 1105, through which the processor 1101 and memory 1102 are typically interconnected, or in other ways.

[0167] The device 1100 provided in this application embodiment is used to execute the methods executed by the first device in the above-described method embodiments and achieve the corresponding beneficial effects. Alternatively, the device 1100 provided in this application embodiment is used to execute the methods executed by the accelerator in the above-described method embodiments and achieve the corresponding beneficial effects. The specific implementation of the device 1100 shown in FIG11 can be referred to the descriptions in the foregoing method embodiments, and will not be repeated here.

[0168] This application also provides a system comprising a processor and an accelerator. The processor executes the steps performed by the processor of the first device in the methods described in the embodiments shown in Figures 1 to 8 above, and the accelerator executes the steps performed by the accelerator in the methods described in the embodiments shown in Figures 1 to 8 above.

[0169] For example, the system has N accelerators. The operation of obtaining the evaluation information of recommended items in multiple subsets through the generative model is performed in parallel by the N accelerators, where N is an integer greater than 1.

[0170] This application also provides a computer-readable storage medium storing a program that, when run on a computer, causes the computer to perform the steps executed by the first device in the method described in the embodiments shown in Figures 1 to 8, or causes the computer to perform the steps executed by the accelerator in the method described in the embodiments shown in Figures 1 to 8.

[0171] This application also provides a computer program product, which includes a program that, when run on a computer, causes the computer to perform the steps performed by the first device in the methods described in the embodiments shown in Figures 1 to 8, or causes the computer to perform the steps performed by the accelerator in the methods described in the embodiments shown in Figures 1 to 8.

[0172] This application also provides a circuit system including a processing circuit configured to perform the steps performed by the first device in the method described in the embodiments shown in Figures 1 to 8, or the processing circuit configured to perform the steps performed by the accelerator in the method described in the embodiments shown in Figures 1 to 8.

[0173] The first device or inference apparatus provided in this application embodiment can specifically be a chip. The chip includes a processing unit, such as a processor. Optionally, the chip also includes a communication unit, such as an input / output interface, pins, or circuits. The processing unit can execute computer execution instructions stored in the storage unit to cause the chip to execute the methods described in the embodiments shown in Figures 1 to 8. Optionally, the storage unit is a storage unit within the chip, such as a register or cache. The storage unit can also be a storage unit located outside the chip within the wireless access device, such as a read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, such as random access memory (RAM).

[0174] The processor mentioned above can be a general-purpose central processing unit, microprocessor, GPU, NPU, TPU, ASIC, FPGA, or one or more integrated circuits used to control the execution of the program in the first aspect of the above method.

[0175] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.

[0176] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CLUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0177] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0178] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

Claims

1. An inference method, characterized by, The method comprises: obtaining input information of a generative model, the input information comprising user data and an item set, the item set comprising a plurality of candidate items; dividing the item set into a plurality of sub-sets, each of the plurality of sub-sets comprising at least one item, wherein the user data and each of the plurality of sub-sets are used to obtain evaluation information of at least one item in each of the plurality of sub-sets by the generative model; determining at least one recommended item from the item set based on the evaluation information of at least one item in each of the plurality of sub-sets.

2. The method of claim 1, wherein, The operation of obtaining the evaluation information of the items in each of the plurality of sub-sets by the generative model is performed in parallel by a plurality of accelerators.

3. The method of claim 2, wherein, The plurality of accelerators comprises N accelerators, N being an integer greater than 1, and the operation of dividing the item set into a plurality of sub-sets comprises: dividing the item set into N sub-sets, the N sub-sets corresponding to the N accelerators one-to-one; and The method further comprises: sending one of the sub-sets to each of the N accelerators.

4. The method according to claim 2 or 3, characterized in that, The processor and the plurality of accelerators are included in the same server, or the processor and the plurality of accelerators are included in the same super pod.

5. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: generating a key value (KV) of the user data, the KV of the user data and each of the plurality of sub-sets being used to obtain evaluation information of at least one item in each of the plurality of sub-sets by the generative model.

6. The method according to any one of claims 1 to 3, characterized in that, The user data comprises at least one historical behavior data of a user, the historical behavior data indicating at least one behavior performed by the user on an item.

7. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: receiving a recommendation request, the recommendation request comprising the user data and the item set; The operation of obtaining the input information of the generative model comprises: determining the input information of the generative model based on the recommendation request.

8. An inference method, comprising: The method is used in a scenario of using a generative model, the input information of the generative model comprising user data and an item set, the item set comprising a plurality of candidate items, and the method comprising: receiving first data and at least one item sent by a processor, wherein the first data is obtained based on the user data, the item set comprises a plurality of sub-sets, and the received at least one item belongs to a first sub-set in the plurality of sub-sets; obtaining evaluation information of at least one item in the first sub-set by the generative model based on the first data and the at least one item in the first sub-set; sending the evaluation information of the at least one item in the first sub-set to the processor, wherein the evaluation information of at least one item in the plurality of sub-sets is used by the processor to determine at least one recommended item from the item set.

9. The method of claim 8, wherein, The first data is a key value (KV) of the user data.

10. An inference apparatus characterized by comprising: The apparatus comprises: an obtaining unit configured to obtain input information of a generative model, the input information comprising user data and an item set, the item set comprising a plurality of candidate items; The processing unit is configured to divide the item set into a plurality of subsets, each of the plurality of subsets including at least one item, wherein the user data and each of the plurality of subsets are used to obtain evaluation information of at least one item in each of the plurality of subsets by using the generative model. The processing unit is further configured to determine at least one recommended item from the item set based on the evaluation information of at least one item in each of the plurality of subsets.

11. The apparatus of claim 10, wherein, The operation of obtaining the evaluation information of the items in the plurality of subsets by using the generative model is performed in parallel by a plurality of accelerators.

12. The apparatus of claim 11, wherein, The plurality of accelerators includes N accelerators, N being an integer greater than 10, and the processing unit is specifically configured to divide the item set into N subsets, the N subsets corresponding to the N accelerators in a one-to-one manner. The apparatus further includes a transceiver configured to send one of the subsets to each of the N accelerators.

13. The apparatus of claim 11 or 12, wherein, The execution subject of the apparatus is a processor, and the processor and the plurality of accelerators are included in a same server, or the processor and the plurality of accelerators are included in a same super pod.

14. The apparatus of any one of claims 10 to 12, wherein, The processing unit is further configured to generate a key value (KV) of the user data, and the KV of the user data and each of the plurality of subsets are used to obtain the evaluation information of at least one item in each of the plurality of subsets by using the generative model.

15. The apparatus of any one of claims 10 to 12, wherein, The user data includes at least one historical behavior data of a user, and the historical behavior data indicates at least one behavior performed by the user on an item.

16. The apparatus of any one of claims 10 to 12, wherein, The apparatus further includes a transceiver configured to receive a recommendation request, the recommendation request including the user data and the item set. The obtaining unit is specifically configured to determine input information of the generative model based on the recommendation request.

17. An inference apparatus characterized by comprising: The apparatus is used in a scenario of using a generative model, input information of the generative model including user data and an item set, the item set including a plurality of candidate items, and the apparatus includes: a transceiver configured to receive first data and at least one item sent by a processor, wherein the first data is obtained based on the user data, the item set includes a plurality of subsets, and the received at least one item belongs to a first subset in the plurality of subsets; a processing unit configured to obtain evaluation information of at least one item in the first subset by using the generative model based on the first data and the at least one item in the first subset; the transceiver is further configured to send the evaluation information of the at least one item in the first subset to the processor, wherein the evaluation information of at least one item in the plurality of subsets is used by the processor to determine at least one recommended item from the item set.

18. The apparatus of claim 17, wherein, The first data is a key value (KV) of the user data.

19. An apparatus, comprising: The device includes a processor and a memory, the memory stores code, and the processor is configured to execute the code, when the code is executed, the processor executes the method in any one of claims 1 to 9.

20. A system, comprising: The system comprises a processor configured to perform the method of any one of claims 1 to 7 and an accelerator configured to perform the method of claim 8 or 9.

21. The system of claim 20, wherein, The number of the accelerators in the system is N, and the operation of obtaining the evaluation information of the recommended items in the plurality of sub-sets by the generative model is performed in parallel by the N accelerators, and N is an integer greater than 1.

22. A computer program product, characterised in that, The computer program product comprises a program which, when executed on a computer, causes the computer to perform the method of any one of claims 1 to 9.

23. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a program, and when the program is executed on a computer, the computer is caused to perform the method of any one of claims 1 to 9.

24. A chip, characterized by The chip comprises a processor configured to perform the steps of the method of any one of claims 1 to 9.