How rucaibox/lc-rec works
LC-Rec combines collaborative item indexing with LLM alignment tuning for recommendation. The documented workflow prepares Amazon interaction data and item features, learns quantized item indices, then uses task-specific prompts and datasets to fine-tune an LLM and run recommendation tests. The graph preserves the README’s task families and conversion-based checkpoint workflow; several links rely on README or index references because runtime entry-point excerpts were not provided.
Main entry points: data.py Task datasets · rqvae.py Residual quantizer · test.py Recommendation inference · generate_indices.py Index generation
Components 27
Data preparation
- Amazon processing
data_process/amazon18_data_process.py - RecBole processing
data_process/amazon18_recbole_data_process.py - Text embeddings
data_process/amazon_text_emb.py - Preference outputs
data_process/get_llm_output.py
Item indexing
- Embedding dataset
index/datasets.py - Index training
index/main.py - Index trainer
index/trainer.py - Residual quantizer
index/models/rqvae.py - Encoder layers
index/models/layers.py - Residual VQ
index/models/rq.py - Vector quantizer
index/models/vq.py - Index generation
index/generate_indices.py - Item indices
LLM recommendation
- Task datasets
data.py - Task prompts
prompt.py - Batch collation
collator.py - Alignment tuning
finetune.py - LoRA tuning
lora_finetune.py - Recommendation inference
test.py - Distributed inference
test_ddp.py
Model artifacts
- Checkpoint conversion
convert/convert.py - Delta merge
convert/merge_delta.py - LC-Rec weights
Other components
- Dataset files
- Recommendation user
- Base LLM
- Recommendation results
Connections 33
- Dataset files → Amazon processing: processes
data_process/amazon18_data_process.py - Dataset files → RecBole processing: processes
- Dataset files → Text embeddings: embeds text
- Dataset files → Preference outputs: generates preferences
data_process/get_llm_output.py - Text embeddings → Embedding dataset: provides embeddings
- Embedding dataset → Index training: loads batches
index/main.py - Index training → Residual quantizer: constructs model
index/main.py - Index training → Index trainer: trains with
index/main.py - Index trainer → Residual quantizer: optimizes
index/trainer.py - Residual quantizer → Encoder layers: uses encoder
index/models/rqvae.py - Residual quantizer → Residual VQ: quantizes through
index/models/rqvae.py - Residual VQ → Vector quantizer: uses codebooks
index/models/rq.py - Index generation → Embedding dataset: loads embeddings
index/generate_indices.py - Index generation → Residual quantizer: loads model
index/generate_indices.py - Index generation → Item indices: writes indices
- Task datasets → Task prompts: formats tasks
data.py - Item indices → Task datasets: loads indices
data.py - Preference outputs → Task datasets: supplies preferences
- Task datasets → Batch collation: batches examples
- Batch collation → Alignment tuning: prepares inputs
finetune.py - Alignment tuning → Base LLM: tunes
- LoRA tuning → Base LLM: adapts
- Recommendation user → Recommendation inference: requests recommendation
- Recommendation inference → Task datasets: loads test examples
- Recommendation inference → Base LLM: generates with
- Distributed inference → Task datasets: loads test examples
- Recommendation inference → Recommendation results: writes predictions
- Distributed inference → Recommendation results: writes predictions
- Alignment tuning → Checkpoint conversion: converts checkpoint
README.md - Checkpoint conversion → LC-Rec weights: produces weights
- LC-Rec weights → Delta merge: applies delta to base
README.md - Delta merge → Base LLM: loads base weights
README.md - Delta merge → LC-Rec weights: writes merged weights
README.md