Manuscript Offprint

arXiv:2610.24481

DuoLM: Fast and Effective Personalized Recommendation with Language Models

Jiang Wu, Yutong Song, Hongbo Wang, Guanghe Cao, Jeff Liang

Abstract

Language models can make personalized recommendations from rich item content, user history, and feedback. However, evaluating many candidates with full-text inputs incurs substantial online computation and limits serving throughput. We introduce DuoLM, a framework for fast and effective personalized recommendation that integrates a compact recommendation model with an efficient serving runtime. An encoder LLM learns compact item representations for offline reuse, while a personalized ranker LLM combines them with user history and feedback for recommendation. We train both models end to end with recommendation supervision and teacher distillation. The runtime further accelerates inference through virtual token IDs for embedding access, shared history computation, and CUDA Graph replay. Benchmark results show that our framework achieves recommendation quality comparable to that of the expert teacher model. On a single H100, it delivers approximately 26,400 candidate scores per second, about 60×60 \times the throughput of the teacher served with vLLM and automatic prefix caching.

1 Introduction

“Nature is an endless combination and repetition of a very few laws. She hums the old well-known air through innumerable variations.”

– Ralph Waldo Emerson, History

From personalized shopping to content discovery, language models use item content, user histories, and feedback to assess which items best match individual preferences (Chen et al., 2024; Ning et al., 2024; Bao et al., 2023). Each recommendation request typically involves multiple candidates, while the system must sustain a continuous stream of requests within a given computational budget. The practical value of language models for recommendation therefore depends on both recommendation quality and serving efficiency.

Despite advances in language-model-based personalized recommendation, efficient online serving remains challenging. We identify two primary challenges.

First, it remains difficult to substantially reduce online computation without compromising recommendation quality. Traditional ID-based two-tower recommenders score items efficiently, but models trained solely on interactions do not directly incorporate textual semantics or pretrained world knowledge. This reliance on interaction data limits generalization to long-tail and cold-start items (Hou et al., 2022; Li et al., 2023; Kim et al., 2024). Full-text cross-encoders use item descriptions together with user history and feedback, but the resulting candidate representations depend on the user context and cannot be directly reused across users. Compressing item text can reduce online computation (Ge et al., 2024; Cheng et al., 2024; Louis et al., 2025), yet may discard details that matter to particular users. The challenge is to obtain compact, reusable item representations that still support high-quality personalized judgments.

Second, a reduction in model computation does not automatically translate into faster end-to-end request processing. Inference engines such as vLLM (Kwon et al., 2023) improve latency and throughput via batching and prefix caching, but redundant work can remain in how a recommendation service prepares and submits its workload. A single recommendation request typically evaluates multiple candidates against the same user history. If candidates are submitted separately, the service may repeatedly construct and transmit the same history inputs and incur separate scheduling overhead for each candidate. Prefix caching can reuse history KV states (Juravsky et al., 2024), but does not per se eliminate these repeated operations. As model execution becomes faster, these overheads

∗^{*}Equal contribution.

can limit end-to-end recommendation throughput.

To address these challenges, we introduce DuoLM, a framework that integrates representation learning and efficient inference for personalized recommendation (Figure 1). The core idea is to learn reusable item representations and personalization together, enabling offline item encoding. Runtime optimizations translate the resulting computational savings into faster serving.

On the model side, an encoder LLM compresses each item's text into a single hidden-state vector, which replaces its text tokens in a personalized ranker LLM. The ranker receives a candidate vector with individual history-item vectors and their associated textual feedback. Each candidate attends to these history entries to produce personalized score.

We co-train the encoder and ranker end to end with recommendation labels and distillation from a frozen full-text teacher (Hinton et al., 2015). Cross-entropy encourages selection of the observed target, while KL divergence encourages the compact model to match the teacher's preference distribution over the same candidates. After training, we precompute item representations offline and run only the ranker online.

On the runtime side, we introduce a series of coordinated optimizations tailored to this model architecture. First, virtual token IDs (VIDs) reference a GPU-resident table of precomputed item embeddings shared by history and candidate items. The runtime resolves these IDs into continuous input embeddings for the ranker. Requests therefore carry item IDs and user feedback instead of full item vectors. In our rating benchmark, VIDs reduce average request payloads by over 90% compared with full-vector transmission.

We build a novel multi-item scoring (MIS) path on SGLang (Zheng et al., 2024) to score multiple candidates in one request. The runtime constructs and prefills the user history once, then shares its prefix KV cache across candidate branches. A tree-structured attention mask allows each candidate to attend only to the shared history and its own branch, preserving independent scoring.

We further adapt the MIS scoring path to segmented prefill CUDA Graphs. These graphs capture GPU operations and their dependencies. The runtime replays the captured graphs to reduce CPU scheduling and kernel launch overhead.

Experiments on Amazon Books and Video Games show: (i) Our model outperforms the expert teacher model on Books recommendation (NDCG@10: 0.5586 vs. 0.5440), with comparable performance on Video Games (0.5298 vs. 0.5313) and Books rating prediction. (ii) On a single H100, recommendation throughput reaches up to 60.1×60.1\times and 109.9×109.9\times that of the teacher served by vLLM and SGLang, respectively. Our contributions can be summarized as follows:

  1. We introduce DuoLM, a framework that learns compact, reusable, efficient representations for personalized recommendation.

  2. We develop an efficient serving runtime that reuses item representations across users and history computation across candidates.

  3. We demonstrate substantial throughput gains with recommendation quality comparable to that of the expert teacher model, and share practical lessons from model and runtime ablations.

References (12)