How meta-recsys/generative-recommenders works
Project Type & Purpose
• Type: Research / open-source codebase for sequential recommender systems re-formulated as generative models.
• Purpose:
– Preprocess and generate datasets (public MovieLens/Amazon & synthetic fractal expansion).
– Train generative recommenders (HSTU, M-FALCON, DLRM-v3) at scale on GPUs.
– Run inference benchmarks (MLPerf LoadGen integration) and efficiency experiments with CUDA & Triton kernels.
Top-Level Components
a. Data Layer
– Raw public data (MovieLens, Amazon Reviews).
– Synthetic data generator (run_fractal_expansion.py).
– Preprocess scripts (preprocess_public_data.py).
– Output: standardized Tensor/CSV datasets under tmp/.
b. Configuration
– gin-config files in configs/ (per-dataset, per-method).
– requirements.txt, setup.py define environment & dependencies.
c. Training Pipeline
– Entry points:
• main.py – orchestrates public experiments (Section 4.1.1).
• generative_recommenders/dlrm_v3/train/train_ranker.py – DLRM‐v3 multi‐GPU training.
– Core modules:
• generative_recommenders/modules/… – feature encoders, attention, STU transducers, preprocessors.
• generative_recommenders/ops/… – optimized kernels in C++/CUDA and Triton (FlashAttention V3, jagged tensors, etc.).
– Dataflow: raw → preprocess → batched tensors → forward/backward through modules → checkpoint.
– Logging: tensorboard under exps/.
d. Inference Pipeline
– Entry points:
• generative_recommenders/dlrm_v3/inference/main.py – MLPerf LoadGen integration.
– Components:
• LoadGen library (thirdparty/loadgen) linked via Python/C API.
• inference_modules.py – wraps model family to respond to LoadGen queries.
• DataProducer – feeds preprocessed data.
– Output: latency & throughput measurements.
e. Research Playground
– generative_recommenders/research/… – data loaders, candidate indexing, sequence modeling modules, sequential losses.
– Allows developing new ranking / similarity algorithms.
f. Efficiency Experiments
– generative_recommenders/ops/cpp/hstu_attention – FlashAttention‐based CUDA kernels.
– generative_recommenders/ops/triton – Triton kernels for end‐to‐end GPU performance testing.
Relationships & Data Flows
• Data Layer → Preprocess Scripts → Dataset
• Dataset + gin-config → Training Entry (main.py or train_ranker.py)
• Training → Modules + Ops (C++/CUDA/Triton) → Checkpoints
• Checkpoints + LoadGen → Inference Entry → Metrics
• Research modules can hook into Data Layer and Modules to prototype new algorithms.
– Show “configuration” as a sidecar component feeding both training and inference.
Architectural Patterns & Design Principles
• Modular design: Python “modules/” define abstract building blocks; “ops/” provide backend acceleration.
• Separation of concerns:
– Data‐preprocessing vs. model logic vs. optimized kernel implementations.
– CLI drivers (main.py, train_ranker.py, inference/main.py) orchestrate high-level workflows.
• Extensibility: dropping in new gin configs, research code, or optimized kernels without touching orchestration scripts.
• Scalability: multi‐GPU support via PyTorch distributed, LoadGen benchmarking, fractal data expansion.
[ ] Components: Data, Config, Training (main.py & train_ranker.py), Modules, Ops, Inference (main.py), Research
[ ] Labels: directory names, scripts, kernels, data artifacts
[ ] Notes: GPU cluster, multi-process orchestration, tensorboard logging, LoadGen integration