Empowering Compact LLMs with Fusion of Layer-wise Exits for Recommendation

Xurong Liang, Tong Chen, Quoc Viet Hung Nguyen, Jianxin Li, Xiangliang Zhang, Hongzhi YinarXiv 2026

TL;DR

FLEXRec introduces a dynamic multi-layer exit fusion paradigm for discriminative, compact Large Language Model-based Recommender Systems (LLM-RSs). By adaptively ensembling prediction score distributions from different transformer depths using a continuous router, it overcomes the capacity limitations of small LLMs without incurring the high latency of autoregressive generation. This allows compact models (1.7B–3B parameters) to match or even outperform much larger models in full-corpus item ranking.

What Problem Does This Paper Address?

Integrating Large Language Models into recommender systems (LLM-RSs) has drastically improved text context modeling and user preference learning. However, deploying massive 7B+ parameter models for real-world, real-time recommendations is computationally unsustainable.

To fix this, researchers have turned to compact LLMs (under 3B parameters). Unfortunately, shrinking the model degrades its semantic comprehension. Current workarounds rely on complex reasoning chains or knowledge distillation, which either introduce massive inference latency or require expensive teacher models. Furthermore, most of these systems are generative, meaning they generate recommendations token-by-token autoregressively—a process far too slow to rank an entire catalog of millions of items (full-corpus ranking).

While discriminative LLM-RSs bypass this by using the LLM as an embedding generator to compute user-item affinity scores instantly, they use a static pipeline. Every user interaction sequence is processed through the exact same layers, making them structurally rigid and prone to the limited expressiveness of smaller backbones. FLEXRec addresses this gap by making compact, discriminative LLM recommenders structurally adaptive and highly accurate without sacrificing their speed advantage.

Methods

FLEXRec breaks away from the traditional single-output constraint of discriminative models. Instead of only using the final layer's embeddings to make a prediction, it treats each transformer block as an independent exit point.

The framework consists of three core components:

  1. Multi-Layer Extension: Prediction heads are inserted after every transformer layer. This design leverages the fact that different depths capture hierarchical patterns: shallow layers model immediate, short-term item transitions, while deeper layers capture abstract, long-term user intents.
  2. Adaptive Continuous Router (AC-Router): Inspired by Mixture-of-Experts (MoE) architectures, this dynamic gating network looks at the incoming user sequence and decides not only which layer exits to activate, but how many. If the deepest active layer is $l_{max}$, the model skips all subsequent layers, effectively pruning the network depth on the fly for simpler sequences.
  3. Target-$k$ Hinge Loss: Traditional MoE routers force a strict top-$k$ selection, which wastes compute on simple inputs and throttles diversity on complex ones. FLEXRec introduces a novel soft cardinality penalty that organically encourages the router to select a variable number of exits within a target range $[1, k]$.
Fig. 1: Overview of the FLEXRec framework and its three-stage training. Stage 1 trains the base components via Lrec. Stage 2 warms up intermediate exits Hinter via Linter. Stage 3 optimizes the AC-Router using Lrec alongside router-specific loss terms (LLB, LHinge, LZ). In the given sequence example, solid green arrows depict active routing weights assigned by the AC-Router, whereas dotted arrows indicate unselected exits that do not contribute to the final fused distribution Ofused.

Training happens in three distinct stages: first, the base LLM backbone and final exit head are trained; second, the backbone is frozen while intermediate exits are warmed up; finally, the entire network is frozen except for the AC-Router, which learns sequence-specific fusion strategies.

Datasets

The authors evaluated FLEXRec on three widely used public benchmark datasets:

  • Amazon Toys and Games (Toys)
  • Amazon Beauty (Beauty)
  • Yelp review dataset (Yelp)

All datasets were preprocessed using standard 5-core filtering (retaining users and items with at least 5 interactions) and evaluated using a leave-one-out strategy. The compact backbones tested were Qwen 3 1.7B and Llama 3.2 3B.

Key Insights and Ideas

  • Hierarchical Semantic Fusion: Fusing representations from multiple layers acts as a regularizer and injects rich, complementary context. This effectively compensates for a compact model's lack of parameter "breadth."
  • Soft Constraints Over Hard Ceilings: Forcing a hard limit on expert/layer activation hurts optimization. Allowing the model to dynamically scale its computational depth via the target-$k$ hinge loss provides better generalizability across diverse user profiles.
  • Decoupled Router Training: Training the router completely separately from the exit heads ensures that the router's gradients purely reflect fusion strategy rather than shifting score distributions, leading to highly stable training.

Key Results

FLEXRec achieves state-of-the-art accuracy among compact-backbone models while maintaining exceptional efficiency:

  • Beating the "Skyline": On the Beauty dataset, FLEXRec using a compact backbone (e.g., Llama 3.2 3B) actually outperformed the "Skyline" baseline—which used the much larger Llama 3.1 8B model running a standard single-exit architecture.
  • Ensemble Superiority: As shown in Figure 2, FLEXRec's adaptive fusion consistently outperforms the best-performing individual independent layer exit across all datasets and backbones.
Fig. 2: Performance distribution (NDCG@20) of all indepen- dent exits across datasets and backbones. The red dashed line, with its exact magnitude marked in bold red on the x-axis, denotes the performance of FLEXRec.
  • Minimal Latency Overhead: Because it avoids autoregressive text generation and utilizes lightweight routing, FLEXRec adds less than 1ms of latency compared to the standard static E4SRec baseline, making it fully viable for real-time production systems.

Limitations and Future Work

While FLEXRec successfully mitigates the capacity limitations of compact LLMs, its performance is still bounded by the quality of the initial collaborative item embeddings (pretrained via SASRec). Additionally, the paper primarily focuses on sequential item IDs mapped to text spaces; exploring how this layer-wise fusion behaves when rich multimodal features (like images or long text reviews) are injected directly into the intermediate layers remains an open avenue for future research.

Summary updated

BibTeX
@misc{liang2026empowering,
  author = {Xurong Liang and Tong Chen and Quoc Viet Hung Nguyen and Jianxin Li and Xiangliang Zhang and Hongzhi Yin},
  title = {{Empowering Compact LLMs with Fusion of Layer-wise Exits for Recommendation}},
  year = {2026},
  eprint = {2608.17316},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.17316},
}
Figure