How hkuds/llmrec works
Data Augmentation Module
• This includes the LLM-based augmentation scripts. Note the subdirectory “LLM_augmentation_construct_prompt” (with files like gpt_i_attribute_generate_aug.py, gpt_ui_aug.py, and gpt_user_profiling.py) which is responsible for generating prompts and completions to augment item attributes, user profiles, and implicit feedback.
Recommendation Model Training Module
• The training stage is executed through “main.py” at the repository root (and similar main.py files in subfolders like LATTICE/codes and MMSSL). This stage takes the augmented data as input and applies recommendation models based on graph augmentation.
• Components include the baseline recommenders derived or modified from LATTICE and MMSSL. Note that each of these baseline directories has its own structure (e.g., “codes” for LATTICE and “utility” for MMSSL) alongside configuration files (like config.yml) and candidate preparation scripts.
Core Utility Components
• “Models.py” files in several directories; these hold key model definitions which are central to performing recommendations.
External Services and Dependencies
• External libraries (PyTorch, CLIP-ViT, Sentence-BERT) as external dependencies, which provide capability for deep learning operations and multi-modal data processing.
• The README emphasizes links to the paper, demo pages, and dataset sources – you might want to note external data sources and research references.
Data Flow & Component Interactions
• The flow begins with raw multi-modal data ingestion and candidate generation (using pre-generated candidate indices) then proceeds into two stages:
– Stage 1 (Data Augmentation): Here, the LLM-based augmentation scripts operate on user and item data to produce enriched feedback and profiles.
– Stage 2 (Recommender Training): The models (from LATTICE, MMSSL and others) train on the augmented data with potential candidate preparation and evaluation via metrics modules.
Architectural Patterns and Design Principles
• Modular Design: The file structure is segmented into different directories for augmentation, baseline implementations, and utilities. Emphasize the modularity and separation of concerns.
• Reusability: The common utility functions and model definitions are reused across multiple modules, indicating a design that emphasizes code reuse.
• Pipeline Flow: The design clearly follows a two-stage data processing pipeline (data enrichment followed by model training and candidate selection).
– From raw multi-modal data (with sources like Netflix dataset) entering the augmentation module.
– From augmentation scripts to the enriched dataset.
– From the enriched dataset feeding into the candidate generation and recommendation model training.
– Application modules (e.g., augmentation scripts, model training scripts) versus utility libraries (e.g., logging, parsing).
– In-house developed components versus external services or libraries.
• Files or folders where appropriate (for example, “LLM_augmentation_construct_prompt”, “LATTICE”, “MMSSL”, “utility”, and “main.py” at multiple locations) to emphasize their roles.
• Incorporate brief notes on the purpose of each module as identified above (e.g., “LLM Augmentation Module: Enhances user/item features using LLM prompts”, “Recommender Training Module: Implements baseline models and leverages augmented data”, etc.).