Text Is All You Need: Learning Language Representations for Sequential Recommendation

Jiacheng Li, Ming Wang, Jin Li, Jinmiao Fu, Xin Shen, Jingbo Shang, Julian J. McAuley

Abstract

Sequential recommendation systems traditionally rely on item IDs, which suffer from cold-start issues and limited transferability across domains. We present Recformer, a framework that represents items purely through their text attributes. By unifying language modeling with recommendation, Recformer leverages a Transformer-based architecture to learn semantic representations of items and user histories. Experimental results on Amazon datasets demonstrate that Recformer significantly outperforms existing ID-based and text-aware models, particularly in zero-shot and cold-start scenarios.

Introduction

Most sequential recommender systems rely on Item IDs. While effective for large, static datasets, ID-based models have two major flaws: the Cold-Start Problem, where new items lack interaction history, and a Lack of Transferability, as IDs are domain-specific. Previous "text-aware" models often used pre-trained language models as fixed feature extractors, creating a gap between language understanding and recommendation. Recformer addresses this by treating "Text Is All You Need," using language as a universal identifier.

Methodology

Recformer unifies language modeling and sequential recommendation into a single architecture.

Item Representation

Instead of an ID, an item is represented by flattening its key-value attributes (e.g., Title: 2020 MacBook Air, Brand: Apple, Color: Gold) into a sequence of words, effectively treating each item as a "sentence."

Architecture and Embeddings

The model utilizes a bi-directional Transformer based on the Longformer structure to handle long user interaction histories efficiently. Beyond standard token and position embeddings, Recformer introduces:

  • Token Type Embeddings: To distinguish between attribute keys and values.
  • Item Position Embeddings: To help the model understand the chronological order of interactions.
Recformer Model Structure and Pre-training Tasks

Pre-training and Training

The model is pre-trained on two simultaneous tasks: Masked Language Modeling (MLM) to learn general semantics, and an Item-Item Contrastive (IIC) Task to distinguish ground-truth next items from negatives in a batch. To stabilize training on smaller datasets, a Two-Stage Finetuning approach is used: first updating item representations, then freezing them to optimize the recommendation head.

Experiments and Results

Recformer was evaluated using a massive slice of Amazon review datasets, pre-trained on seven categories (e.g., Electronics, Clothing) and fine-tuned on six distinct target domains (e.g., Scientific, Arts) to test transferability.

Performance Gains

Recformer significantly outperformed both ID-only (e.g., SASRec) and existing text-only (e.g., UniSRec) baselines. On average, it improved NDCG@10 by 15.83% and MRR by 15.99% over the second-best baselines.

Performance comparison (NDCG@10) across different domains

Zero-Shot and Cold-Start Resilience

In zero-shot settings, Recformer improved performance by up to 39.78%, proving its ability to generalize across domains. It also maintained high accuracy in cold-start simulations where test items were unseen during training, a scenario where ID-based models typically fail.

Conclusion

Recformer demonstrates that language can serve as a universal ID, providing a semantic prior that links related items across domains. While it offers superior accuracy and transferability, the computational overhead of processing long text sequences remains a challenge for real-time systems. Future work may explore multimodal inputs, such as images, to further enhance the robustness of ID-free recommendation.

Summary updated

BibTeX
@inproceedings{li2023text,
  author = {Jiacheng Li and Ming Wang and Jin Li and Jinmiao Fu and Xin Shen and Jingbo Shang and Julian J. McAuley},
  title = {{Text Is All You Need: Learning Language Representations for Sequential Recommendation}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2023},
  doi = {10.1145/3580305.3599519},
}
Figure