TokenRec
A T5-small recommender that reads vector-quantized user and item ID tokens and outputs an item representation.
Tabular and recommender · 891 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 66.1M
- Operations
- 891
- Framework
- PyTorch
- Recurrent
- No
- Published
- IEEE Transactions on Knowledge and Data Engineering (arXiv 2024)
- Cited by
- 3 (as of 28 October 2026)
- Authors
- Haohao Qu, Wenqi Fan, Zihuai Zhao, Qing Li
- Source
- GitHub: Quhaoh233/TokenRec
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m20991
- Graph hash
- b082a621ee385686b96baf69adc83a63c7768ad41e3ac336d0e9c732fd10dc17
- Skeleton hash
- ab95421e4e563123d62312f28072b92d7a7a981a7a8c3ffa9f617f0cf5a30896
- Architecture hash
- 8bb7e108cb1f639bd6904e4dfda8da60b9b2012795d2003703eb6563d79f3969
- Diagram SHA-256
- 6f310dd17c2895bb9157750bc3ee92aea39d27ef6d2949373d979497bb84dfe3
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
TokenRec is a recommender system built on a large language model (LLM), with tokenizers for users and items and a generative retrieval paradigm. Its tokenizer, the Masked Vector-Quantized Tokenizer (MQ-Tokenizer), quantizes masked user and item representations learned from collaborative filtering into discrete tokens, so that each ID becomes a short list of tokens the LLM can read. In the paper's experiments those representations come from LightGCN, and K = 3 sub-codebooks is the suggested setting.
The backbone is T5-small, which the paper uses for TokenRec and for all LLM-based baselines. Instead of decoding item names token by token, the model generates an item representation for the user and scores it against stored item representations with a matching function such as cosine similarity. That removes the auto-regressive decoding and beam search used by LLMs, which the abstract calls time-consuming. The MQ-Tokenizers are trained first and then frozen while the LLM backbone, its token embeddings and the projection layer are tuned with a pairwise ranking loss.
The paper evaluates on four benchmark datasets, Amazon-Beauty, Amazon-Clothing, LastFM and MovieLens 1M, and reports that TokenRec outperforms both traditional and LLM-based recommender baselines. According to the paper, items unseen during fine-tuning can be retrieved by updating only the pool of item representations instead of retraining the entire model.
Key idea. TokenRec tokenizes user and item IDs by vector-quantizing masked collaborative filtering representations, and recommends by retrieving items with a generated representation instead of auto-regressive decoding.
- TokenRec
- MQ-Tokenizer
- Masked Vector-Quantized Tokenizer
- ID tokenization
- LLM-based recommendation
- generative retrieval
- vector quantization
- collaborative filtering
- recommender systems
- generative recommendation
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{qu2025tokenreclearningtokenizeid,
title={TokenRec: Learning to Tokenize ID for LLM-based Generative Recommendation},
author={Haohao Qu and Wenqi Fan and Zihuai Zhao and Qing Li},
year={2025},
eprint={2406.10450},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/2406.10450},
}