The overall architecture

Typical three-tier architecture in the industry: recall + sorting + post-processing, the process is as follows:

According to the speed of response to user behavior, the system can be roughly divided into offline training and online training.

Offline recommendations

Offline training recommendation system architecture is the most common one. Training with data over a period of time (such as weeks or weeks), model iteration cycles are long (typically in hours). The model fits the medium – and long-term interests of users.

As shown in the figure below, A typical recommendation system architecture based on offline training consists of data reporting, offline training, online storage, real-time computing and A/B testing. Among them, data reporting and off-line training constitute the learning system in supervised learning, while real-time computing and A/B testing constitute the prediction system. In addition, in addition to the model, there is an online storage module for storing the model and the characteristic information required by the model for the real-time computing module to call. Each module in the figure consists of training and prediction data flow. The data flow of training collects the business data and generates the model and stores it in the online storage module. The predicted data flow receives the prediction request of the service and accesses the real-time computing module through A/B test module to obtain the prediction result.

  1. Data reporting: The function of the data reporting module is to collect business data to form training samples. Generally divided into collection, validation, cleaning and conversion steps. The collected data is converted into the sample format required for training and stored in the offline storage module.

  1. Offline training: The line training module is subdivided into offline storage and offline computing. The recommendation system used in actual services generally needs to process massive user behavior data, so the offline storage module needs a distributed file system or storage platform to store the data. The common operations of off-line computing include sample sampling, feature engineering, model training, similarity calculation, etc.

  2. Online storage: Because online services have strict requirements for latency. For example, if a user opens a mobile APP, he must expect the APP to respond quickly. If it takes too long, the user experience will be affected. Generally speaking, this requires the recommender system to process user requests and return recommender results within tens of milliseconds. Therefore, for online services, a special online storage module is required to store online model and feature data.

  3. Real-time recommendation: The function of the real-time recommendation module is to predict new requests from the business. 1. Obtain user characteristics; 2. Call the recommendation model; 3. Result ordering.

In practical applications, because the list of business items is too large, if the real-time calculation of each item is scored using a complex model, it may take too long and affect user satisfaction. So, a common practice is to split recommendation list generation into recall and sort steps. The effect of a recall is to sift through a large number of candidates (say millions) to find a set of candidates (typically hundreds) that a user is more likely to like. The sorting function is to score the relatively small set of candidates obtained by recall using the sorting model. Furthermore, after the list of recommendations is sorted, a third step of reordering filtering (post-processing) is added for the sake of diversity and operation, which is used to process the refined list of recommendations.

  1. A/B testing: A/B testing is basically A necessary module for Internet products, and recommendation systems are no exception. It can help developers evaluate the impact of new algorithms on customer behavior. In addition to the offline indicators, A new recommendation algorithm will generally go through A/B test to test the effectiveness of the new algorithm before it goes online.

The following figure shows the flow of each component in the corresponding actual system. It should be noted that recall and sorting operations have been completed when the recommendation list is generated, and the business layer can directly call the API to get the recommendation list.

Recalling algorithm

  • UserCF

  • ItemCF

  • Traditional matrix factorization (MF) & SVD & SVD++

  • BPR

  • item2vec/word2vec/embedding

Sorting algorithm

  • Logistic Regression

  • GBDT

  • GBDT+LR

  • GBDT+FM

  • LightGBM

  • DNN+GBDT+FM

DNN

  • PNN
  • Wide & Deep
  • DIN
  • DIEN

post-processing

So far we have can be recommended to the user is most likely to purchase the goods, but considering the recommended periodic (impossible runs only once, right?), and can therefore be combined with our business needs to design some business rules, such as: how long does it take after users to buy the same goods to continue to recommend the goods (even if the model to calculate the probability of high); Or the same product is recommended repeatedly in several consecutive recommendation cycles, users still do not buy, we can not force others, and so on. There are many ways to implement business filtering. SQL can periodically build duplicate commodity tables, and the sorted recommendation results can be associated with the table for filtering and recommendation, and so on. There are some problems such as cold start and new users deal, different scene processing method, can do some processing and added to the algorithm, and also can walk alone another set of processes, such as creating hot list of rules, to new users only push hot list of commodities, or push new products to active users, the benefits are for active users or hot items, Associating new products/users with them can quickly generate interactive data for subsequent recommendation.Copy the code

RM System Introduction

The data reported

After the user reports the product data, user data and behavior data to Daguan through THE API interface, the “Data Reporting” module will display the data in real time, and the user can retrieve, edit and view the data in this module. “Product/Behavior Data Statistics” can be used to collect statistics on the quantity and types of daily reported data.

In the “Strategy Management” module, users can configure the algorithm used in a recommendation result and its recall ratio, and support the ranking weight of recall results of different algorithms. In addition to algorithm strategies, the system also preset the configuration of diversity, timeliness and the use of complementary strategies.

Online management

Combine recall, sequencing, and post-processing to form a recommendation.

An online plan can be formed by selecting the corresponding recommended scheme.

Finally, we can also create some special scenes for the online scheme through some crowd portraits.

Through these Settings, recall, sorting and post-processing strategies will be selected according to the recommended schemes contained in the online scheme during training to complete the three-step training, thus forming a recommended list with both performance and response.