  Recent advancements in Natural Language Processing (NLP) have led to the
development of NLP-based recommender systems that have shown superior
performance. However, current models commonly treat items as mere IDs and adopt
discriminative modeling, resulting in limitations of (1) fully leveraging the
content information of items and the language modeling capabilities of NLP
models; (2) interpreting user interests to improve relevance and diversity; and
(3) adapting practical circumstances such as growing item inventories. To
address these limitations, we present GPT4Rec, a novel and flexible generative
framework inspired by search engines. It first generates hypothetical "search
queries" given item titles in a user's history, and then retrieves items for
recommendation by searching these queries. The framework overcomes previous
limitations by learning both user and item embeddings in the language space. To
well-capture user interests with different aspects and granularity for
improving relevance and diversity, we propose a multi-query generation
technique with beam search. The generated queries naturally serve as
interpretable representations of user interests and can be searched to
recommend cold-start items. With GPT-2 language model and BM25 search engine,
our framework outperforms state-of-the-art methods by $75.7\%$ and $22.2\%$ in
Recall@K on two public datasets. Experiments further revealed that multi-query
generation with beam search improves both the diversity of retrieved items and
the coverage of a user's multi-interests. The adaptiveness and interpretability
of generated queries are discussed with qualitative case studies.
