Table of Contents
Fetching ...

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.

BEAR: Towards Beam-Search-Aware Optimization for Recommendation with Large Language Models

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- token-wise ranking for positive items, implemented via a differentiable surrogate and integrated with the standard SFT objective as . BEAR yields substantial gains, with an average improvement of around 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 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- 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.
Paper Structure (14 sections, 6 equations, 9 figures, 5 tables)

This paper contains 14 sections, 6 equations, 9 figures, 5 tables.

Figures (9)

  • Figure 1: Illustration of beam search applied to SFT-trained LLMs vs. BEAR-trained LLMs (beam width $B = 2$). The blue paths represent candidate items retrieved by beam search (e.g., "A Beautiful Mind"), while red circles mark the positive item (e.g., "Bocchi the Rock!"). (a) In the SFT case, although the positive item possesses the highest overall probability, it is pruned at the first step due to the insufficient probability of its prefix (e.g., "Bocchi"). (b) BEAR promotes ranking each positive token within the top-$B$ among all possible tokens, making beam search more likely to retain the positive item.
  • Figure 2: Instruction prompt template.
  • Figure 3: Performance comparison between SFT and BEAR on the Book dataset. PruningRate@10 denotes the pruning rate with beam width $B = 10$, i.e., the proportion of positive items that rank within the top-10 in overall probability yet are pruned during beam search. The complete results are presented in \ref{['tab:main-results', 'fig:pruning-rate']}.
  • Figure 4: An overwhelming majority of positive items with high overall probabilities (i.e., top-$K$ ranked among candidates) are pruned during beam search, where failure to meet the necessary condition (\ref{['eq:necessary_condition']}) is the primary cause (marked as red rectangles). Here, we set beam width $B = 10$ and number of recommended items $K \in \{5, 10\}$. "Prop" denotes the proportion of pruning cases attributable to necessary condition violations (red), consistently accounting for over 70% of all pruning cases (red and gray) across all settings.
  • Figure 5: Running time comparison of three training objectives: SFT, BEAR, and objective (\ref{['eq:sufficient_condition']}). While SFT and BEAR have comparable training time, optimizing the objective (\ref{['eq:sufficient_condition']}) is significantly more time-consuming due to the need for beam search simulation during training. Refer to \ref{['fig:training-efficiency']} for complete results in training efficiency.
  • ...and 4 more figures