# yxinjiang/recommendersystem architecture

> Architecture diagram of the GitHub repository yxinjiang/recommendersystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yxinjiang/recommendersystem
- Repository: https://github.com/yxinjiang/recommendersystem

## Overview

##### Main Components
- Overview/Basics (foundational concepts and AB testing)
- Candidate Generation (召回) including various retrieval methods (ItemCF, UserCF, matrix completion, dual-tower models, etc.)
- Ranking (排序) which includes multi-objective ranking, mixture-of-experts models, score fusion, and duration modeling.
- Cross Structure (交叉结构) where techniques like Factorized Machines and Deep & Cross Networks are explained.
- User Behavior Sequence Modeling (用户行为序列建模) featuring models like DIN and SIM for sequence-based features.
- Diversity and Re-ranking (多样性) that covers diversity metrics, MMR, rule constraints, and DPP approaches.
- Cold Start (物品冷启动) addressing challenges and solutions associated with new items.
- KPI and Improvement Methods (涨指标的方法) discussing strategies to boost key performance indicators.

##### Representing Components and Their Interactions
- For instance, begin with raw data or user behavior input moving into the Retrieval stage.
- The output from Ranking might then be further processed through Cross or Re-ranking modules for additional diversity assurance.

##### Highlighting Architectural Patterns and Design Principles
- Interplay between traditional similarity-based methods (like ItemCF and UserCF) and modern deep learning approaches (dual-tower, deep retrieval, deep cross networks).

##### Relevant Technologies and Frameworks
- If applicable, you may optionally annotate or include notes on typical deployment scenarios (such as real-time inference engines, distributed storage for large-scale user data, etc.), even if these are not part of the code but are conceptually important.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Recommendation Pipeline"
        Basics["Overview/Basics"]:::basics
        Retrieval["Candidate Generation (Retrieval)"]:::retrieval
        Ranking["Ranking Models"]:::ranking
        Cross["Cross Structure"]:::cross
        UserBehavior["User Behavior Sequence Modeling"]:::user
        Diversity["Diversity and Re-ranking"]:::diversity
        ColdStart["Cold Start (物品冷启动)"]:::cold
        KPI["KPI and Improvement Methods"]:::kpi
    end

    Basics -->|"flows_to"| Retrieval
    Retrieval -->|"flows_to"| Ranking
    Ranking -->|"branches_to"| Cross
    Ranking -->|"branches_to"| UserBehavior
    Cross -->|"merges_into"| Diversity
    UserBehavior -->|"merges_into"| Diversity
    Diversity -->|"flows_to"| ColdStart
    ColdStart -->|"flows_to"| KPI

    %% Click Events for Overview/Basics
    click Basics "https://github.com/yxinjiang/recommendersystem/blob/main/Notes/01_Basics.pdf"
    click Basics "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/01_Basics_01.pdf"
    click Basics "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/01_Basics_02.pdf"
    click Basics "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/01_Basics_03.pdf"

    %% Click Events for Candidate Generation (Retrieval)
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_01.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_02.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_03.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_04.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_05.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_06.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_07.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_08.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_09.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_10.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_11.pdf"
    click Retrieval "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/02_Retrieval_12.pdf"

    %% Click Events for Ranking
    click Ranking "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/03_Rank_01.pdf"
    click Ranking "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/03_Rank_02.pdf"
    click Ranking "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/03_Rank_03.pdf"
    click Ranking "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/03_Rank_04.pdf"
    click Ranking "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/03_Rank_05.pdf"
    click Ranking "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/03_Rank_06.pdf"

    %% Click Events for Cross Structure
    click Cross "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/04_Cross_01.pdf"
    click Cross "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/04_Cross_02.pdf"
    click Cross "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/04_Cross_03.pdf"
    click Cross "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/04_Cross_04.pdf"

    %% Click Events for User Behavior Sequence Modeling
    click UserBehavior "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/05_LastN_01.pdf"
    click UserBehavior "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/05_LastN_02.pdf"
    click UserBehavior "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/05_LastN_03.pdf"

    %% Click Events for Diversity and Re-ranking
    click Diversity "https://github.com/yxinjiang/recommendersystem/blob/main/Notes/06_Rerank.pdf"
    click Diversity "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/06_Rerank_01.pdf"
    click Diversity "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/06_Rerank_02.pdf"
    click Diversity "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/06_Rerank_03.pdf"
    click Diversity "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/06_Rerank_04.pdf"
    click Diversity "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/06_Rerank_05.pdf"

    %% Click Events for Cold Start (物品冷启动)
    click ColdStart "https://github.com/yxinjiang/recommendersystem/blob/main/Notes/07_ColdStart.pdf"
    click ColdStart "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/07_ColdStart_01.pdf"
    click ColdStart "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/07_ColdStart_02.pdf"
    click ColdStart "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/07_ColdStart_03.pdf"
    click ColdStart "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/07_ColdStart_04.pdf"
    click ColdStart "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/07_ColdStart_05.pdf"
    click ColdStart "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/07_ColdStart_06.pdf"

    %% Click Events for KPI and Improvement Methods
    click KPI "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/08_Improvement_01.pdf"
    click KPI "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/08_Improvement_02.pdf"
    click KPI "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/08_Improvement_03.pdf"
    click KPI "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/08_Improvement_04.pdf"
    click KPI "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/08_Improvement_05.pdf"
    click KPI "https://github.com/yxinjiang/recommendersystem/blob/main/Slides/08_Improvement_06.pdf"

    %% Styles
    classDef basics fill:#f9e79f,stroke:#7d6608,stroke-width:2px;
    classDef retrieval fill:#aed6f1,stroke:#1b4f72,stroke-width:2px;
    classDef ranking fill:#a9dfbf,stroke:#145a32,stroke-width:2px;
    classDef cross fill:#f5cba7,stroke:#7d6608,stroke-width:2px;
    classDef user fill:#d2b4de,stroke:#6c3483,stroke-width:2px;
    classDef diversity fill:#fcf3cf,stroke:#7d6608,stroke-width:2px;
    classDef cold fill:#f5b7b1,stroke:#922b21,stroke-width:2px;
    classDef kpi fill:#aed6f1,stroke:#1b4f72,stroke-width:2px;
```
