BEAR: Towards Beam-Search-Aware Optimization for Recommendation with Large Language Models
Weiqin Yang, Bohao Wang, Zhenxiang Xu, Jiawei Chen, Shengjia Zhang, Jingbang Chen, Canghong Jin, Can Wang
TL;DR
The paper addresses the mismatch between SFT and beam-search decoding in LLM-based recommender systems, where high overall probability does not guarantee retrieval due to prefix pruning. It introduces BEAR, a beam-search-aware regularization that enforces a top-$B$ token-wise ranking for positive items, implemented via a differentiable surrogate and integrated with the standard SFT objective as $\mathcal{L}_{\text{BEAR}} = \mathcal{L}_{\text{SFT}} + \lambda \mathcal{L}_{\text{reg}}$. BEAR yields substantial gains, with an average improvement of around $12.5\%$ in NDCG@K and HitRatio@K across four real-world datasets, and markedly reduces the pruning rate of high-quality items during beam search. The method is model-agnostic, computationally efficient (no extra forward passes), and robust across backbones and LLM sizes, offering a practical path to more reliable LLM-based recommender systems. The work highlights the importance of aligning training objectives with inference dynamics to close the gap between learning and deployment in generative retrieval tasks.
Abstract
Recent years have witnessed a rapid surge in research leveraging Large Language Models (LLMs) for recommendation. These methods typically employ supervised fine-tuning (SFT) to adapt LLMs to recommendation scenarios, and utilize beam search during inference to efficiently retrieve $B$ top-ranked recommended items. However, we identify a critical training-inference inconsistency: while SFT optimizes the overall probability of positive items, it does not guarantee that such items will be retrieved by beam search even if they possess high overall probabilities. Due to the greedy pruning mechanism, beam search can prematurely discard a positive item once its prefix probability is insufficient. To address this inconsistency, we propose BEAR (Beam-SEarch-Aware Regularization), a novel fine-tuning objective that explicitly accounts for beam search behavior during training. Rather than directly simulating beam search for each instance during training, which is computationally prohibitive, BEAR enforces a relaxed necessary condition: each token in a positive item must rank within the top-$B$ candidate tokens at each decoding step. This objective effectively mitigates the risk of incorrect pruning while incurring negligible computational overhead compared to standard SFT. Extensive experiments across four real-world datasets demonstrate that BEAR significantly outperforms strong baselines. Code will be released upon acceptance.
