arXiv:2610.37973cs.IROct 2026

Manuscript Offprint

arXiv:2610.37973

Merge and Branch: Efficient Tree-Structured Supervised Fine-Tuning of LLMs for Recommendation

Yunqin Zhu, Yao Xie

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

LLM-based generative recommendation reads long, text-rich interaction histories but generates only short semantic identifiers (SIDs). This asymmetry makes supervised fine-tuning inefficient: encoding the history is expensive, yet each history usually provides supervision for only one target. We present Merge and Branch (M&B) to reduce input cost and learn more from each encoded history. Merge compresses each historical item's SID and text into a small number of learned tokens. Branch uses the compressed history to predict multiple target SIDs. To share history computation while keeping these targets independent, M&B organizes each example as a shallow, wide tree. We develop tree FlashAttention to execute this layout efficiently, processing the shared history once and propagating gradients from every branch for end-to-end training. A tree-structured key/value cache extends history sharing to constrained decoding. Experiments on public benchmarks show that M&B outperforms strong recommendation baselines while substantially improving training and decoding efficiency.

1 Introduction

Generative recommendation retrieves catalog items by predicting their semantic identifiers (SIDs) from a user's interaction history [28]. SIDs provide compact item representations, while item text, such as titles and categories, supplies additional content that large language models (LLMs) can use to interpret user preferences [10, 13, 41]. Incorporating this text, however, creates an imbalance between input cost and supervision: a model may process thousands of history tokens to predict a next-item SID of only a few tokens. This raises a practical question: how can we reduce the cost of processing each history while learning more from it?

Reducing input cost calls for a compact representation that retains SID and textual information as well as the sequence of interactions. Learning more from each history also requires looking beyond the next item, which provides only one observation of a user's preferences. Additional future interactions in the training sequence offer further observed targets. A trained teacher recommender can also propose synthetic targets, transferring collaborative information through its item predictions. These additional targets should each be predicted from the observed history, without requiring other target items at inference. Naively training a separate example for every target satisfies this requirement but repeatedly processes the same history. We therefore seek a training structure that shares the history across predictions while keeping the targets separate.

To address the challenges, we propose Merge and Branch (M&B), which combines a compact history with multiple independent target branches (Figure 1). Merge compresses each historical item's SID and text into a small number of learned tokens.

Yao Xie

yao.xie@isye.gatech.edu

Georgia Institute of Technology

Atlanta, GA, USA

Figure

Figure 1: Generative recommendation paradigms. M&B pairs compact SID-text inputs with independent SID targets.

SID-conditioned queries select content within each item, and the resulting tokens remain in chronological order so that the LLM can model dependencies across interactions. Branch uses this compact history to predict the next item, additional observed future items, and teacher-proposed synthetic targets. Each target attends to the shared history and its own preceding SID tokens, forming a shallow tree in which targets cannot read one another. Losses from all branches jointly train the history representation and the LLM.

Efficient execution is essential to realizing the benefit of this structure. We develop tree FlashAttention (tree FA) with forward and backward kernels that support the branch visibility pattern without materializing a dense attention matrix. The kernels compute the shared history once and accumulate gradient contributions from every branch. The same sharing principle extends to constrained beam search. Beam hypotheses use the same history but differ in their generated SIDs, so our tree-structured key/value (KV) cache stores the history once and maintains separate states for each hypothesis.

Experiments on three Amazon domains show that M&B outperforms the sequential and generative recommendation baselines in our evaluation. Ablations show that learning from multiple targets improves recommendation quality with compact history representations. Efficiency measurements demonstrate substantially lower training cost than processing uncompressed SID and text histories. Shared-prefix caching also reduces beam-search latency and memory usage, with the largest benefits at long contexts.

Our contributions are threefold:

  • We introduce M&B, an LLM-based generative recommendation framework that reduces history input cost and learns from multiple targets through a shared history.
  • We design an interaction token merger and a multi-target training objective that combines observed and synthetic targets while keeping target predictions independent.

  • We develop tree FlashAttention with forward and backward support and a shared-prefix KV cache to execute multi-target training and constrained beam search efficiently.

References (20)