Skip to content

Menu

WorksComputer Science

OptST: Optimizing Semantic Tokenization for LLM-Enhanced Recommendation

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_ujaergj3. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Semantic information can enrich the identifiers and structured fields used by recommender systems. Semantic tokenization provides a structured representation of this information by converting LLM-derived user profiles into discrete tokens. In the common two-stage pipeline, the tokenizer is trained before the recommender. Its token assignments are then treated as fixed input features during recommendation training. As a result, the downstream recommender can learn how to use the assigned indices, but it cannot revise the semantic partition that produced them. Making this partition task-aware is difficult because nearest-code assignment is discrete, and unconstrained adaptation may also distort the geometry learned during pretraining. Moreover, a fixed token depth exposes the same semantic resolution to every interaction. We thus propose OptST (Optimizing Semantic Tokenization), which makes a pretrained tokenizer responsive to downstream recommendation. To revise token assignments without directly updating the pretrained encoder or base codebooks, OptST learns a low-rank deformation whose drift is limited by an anchor regularizer. Recommendation supervision reaches this transformation through a straight-through estimator, while prediction retains hard nearest-code assignments. Beyond adapting the assignments themselves, OptST selects an interaction-conditioned prefix to control how much residual detail is exposed to the recommender. Experiments on four public datasets show that OptST achieves the highest AUC among conventional and LLM-enhanced baselines. Its improvements also persist across different recommendation backbones. These results establish task-aware semantic tokenization as an effective interface between LLM-derived profiles and downstream recommendation models.

CCS Concepts · Information systems → Recommender systems; · Computing methodologies → Machine learning.

Introduction

Modern recommender systems mainly rely on structured features, such as user IDs, item IDs, and interaction histories [7, 28, 35, 36]. These features effectively capture collaborative patterns but contain little explicit semantic information. In practical applications, recommendation decisions often depend on semantic knowledge about item content and high-level user preferences that cannot be reliably recovered from interaction identifiers alone [4, 21, 33, 40]. This need becomes particularly important in sparse and cold-start scenarios, where collaborative evidence is limited [44, 47]. Large language models (LLMs) provide a practical way to introduce such knowledge by distilling item content and historical user behavior into natural-language profiles and dense semantic representations [6, 16, 20]. These representations complement conventional collaborative features with explicit descriptions of users and items, making LLM-derived semantics an increasingly important input modality for modern recommender systems.

As illustrated in Figure 1, existing methods mainly incorporate LLM-derived semantics into conventional recommenders through three continuous-representation paradigms. The most direct approach treats semantic embeddings as auxiliary features and concatenates them with ID-based representations before feature interaction [15, 40]. A second line of work aligns the semantic and collaborative representation spaces, typically via contrastive or matching objectives, making language-derived features more compatible with collaborative behaviors [13, 31]. A third approach learns lightweight semantic adapters that transform or compress pretrained semantic embeddings before passing them to the downstream recommender, thereby retaining semantic knowledge without involving the LLM during online inference [2, 24]. Despite their different designs, these approaches ultimately represent semantic information as dense, fixed-length continuous vectors. In large-scale applications, caching such vectors for millions of users and items and repeatedly fetching them for long behavior histories or large candidate sets can introduce substantial storage and memory-bandwidth overhead [18, 27]. Moreover, a flat vector provides neither a compact, shared categorical interface across entities nor an explicit mechanism for accessing semantic information at different levels of resolution. These constraints motivate a storage-efficient semantic interface for downstream recommendation.

Figure 1. Representative paradigms for integrating LLM-derived semantics into recommendation models.

Semantic tokenization provides a different interface for delivering semantic information to the downstream recommender, as shown in Figure 1. It maps a dense semantic representation into a short sequence of discrete code indices, commonly using a residual-quantized variational autoencoder (RQ-VAE) [12]. Semantic tokens were first widely explored as autoregressive identifiers in generative recommendation [8, 26] and have subsequently been introduced as categorical input fields for conventional downstream recommenders via standard embedding lookups [18, 27]. This interface is independent of how the tokenizer is trained: semantic tokens may be learned through reconstruction alone or further shaped by collaborative alignment and behavior supervision [44, 45]. Recent systems also combine discrete tokens with continuous semantic features [19, 29], showing that these integration interfaces can be complementary.

Despite these advantages, semantic tokenization is commonly implemented as a two-stage pipeline. A tokenizer is first trained through semantic reconstruction and then used to generate discrete IDs for a downstream recommender [18, 27, 29]. To incorporate recommendation-related information before this boundary, some methods additionally introduce collaborative or behavioral alignment during tokenizer construction [44, 45]. Such alignment can make the resulting tokens more compatible with collaborative signals, but it remains an upstream proxy for the objective of the downstream recommender. Once the tokens are passed to the recommender, their assignments remain fixed with respect to its training objective. The recommender can learn how to embed and combine the assigned indices, but it cannot revise the quantization partition that produced them. As a result, if two semantic representations are mapped to the same token sequence, their tokenized inputs to the recommender are identical, even when distinguishing them would benefit the downstream objective. The central challenge is therefore to let the downstream recommendation objective revise token assignments while constraining the tokenizer’s departure from the semantic structure learned during pretraining.

To address the challenge, we propose OptST (Optimizing Pre-trained Semantic Tokenizers), a framework that adapts a pretrained semantic tokenizer with downstream recommendation supervision. Optimizing semantic tokenization requires more than learning new embeddings for fixed token IDs. First, the assignment geometry should capture distinctions that matter to the recommendation while remaining anchored to the semantic structure acquired during pretraining. Second, the residual depth should expose an appropriate level of detail for each user–item interaction rather than applying the same fixed depth universally. These requirements give rise to two main challenges. First, hard nearest-code assignment prevents downstream gradients from reaching the tokenizer, while unconstrained codebook updates may distort the geometry acquired during pretraining. The tokenizer must therefore become task-responsive without drifting into a purely collaborative partition. Second, choosing the token prefix requires discrete continue-or-stop decisions, making it difficult to learn interaction-dependent depth without collapsing to a fixed policy. OptST addresses these challenges while keeping the pretrained semantic encoder and base RQ codebooks frozen. At each residual layer, it applies a near-identity low-rank transformation shared by all codewords in that layer, allowing the effective assignment geometry to adapt while anchor regularization constrains its deviation from the pretrained codebook. A hard-forward, soft-backward straight-through estimator retains discrete token assignments during prediction while supplying surrogate gradients from the recommendation loss to the low-rank transformations and token embedding tables. OptST further introduces an interaction-conditioned prefix-depth selector that determines how many residual layers to expose based on the current quantization state and interaction context. A straight-through continue-or-stop decision makes the selector trainable, while depth regularization discourages it from defaulting to the maximum depth. The resulting tokens retain the standard categorical-feature interface and can therefore be incorporated into different downstream recommenders without changing their basic architectures. Experiments on four public datasets show that OptST achieves the best performance across all datasets and produces positive gains with five additional recommendation backbones. Ablation studies further verify the effectiveness of codebook adaptation and interaction-conditioned depth selection. Our main contributions are summarized as follows:

  • We study how pretrained hierarchical semantic tokenizers can be adapted for downstream recommendation. We frame this adaptation around two complementary dimensions: the codebook geometry should make token assignments responsive to recommendation signals, while the quantization depth should provide an appropriate semantic resolution for each user–item interaction.

  • We propose OptST, which keeps the pretrained semantic encoder and base codebooks frozen while adapting the effective RQ geometry through shared low-rank transformations, anchor regularization, and straight-through token assignment. An interaction-conditioned depth selector provides complementary control over the resolution exposed to the downstream recommender.

  • We conduct extensive experiments on four public datasets using various recommendation architectures. The results demonstrate improved performance across the evaluated settings and clarify the respective contributions of codebook adaptation and prefix-depth selection.

Related Work

LLM-Enhanced Recommendation

Large language models have increasingly been used to complement the collaborative signals learned from user–item interactions with open-world semantic knowledge [16, 20]. Earlier content-aware recommenders extracted textual features from item descriptions and supplied them directly to prediction models [43]. Recent methods use LLMs to construct richer semantic representations at different granularities, including feature-level knowledge [2, 40], individual user behaviors [5], generated user profiles [4, 33], and multimodal representations for sparse or cold-start entities [47]. Other studies adapt LLM-derived representations to specific recommendation data through prompting or lightweight semantic modeling [15, 24].

These representations also differ in how they enter the downstream recommender. One approach treats semantic embeddings as auxiliary dense features and combines them with conventional ID representations [15, 47]. Another aligns semantic and collaborative representation spaces before downstream prediction [13, 31]. A third introduces lightweight adapters or field-level knowledge injection to transform semantic features into representations compatible with existing recommenders [2, 24, 40]. These mechanisms are not mutually exclusive, but they ultimately expose semantic information through continuous vectors. OptST focuses instead on the discrete semantic interface introduced by semantic tokenization.

Semantic Tokenization for Recommendation

Semantic tokenization maps a dense representation to a short sequence of discrete codes using vector quantization or residual quantization [12, 30, 46]. In generative recommendation, these codes form the vocabulary through which items are generated. TIGER is an early representative that applies RQ-VAE to item-content embeddings and autoregressively predicts the resulting Semantic IDs [26]. Subsequent methods incorporate collaborative semantics, learnable tokenization, behavior-aware objectives, or contrastive quantization into the construction of Semantic-ID [37, 39, 48, 49]. PLUM adapts pretrained language models to Semantic-ID generation at an industrial scale, while more recent work studies end-to-end Semantic-ID construction for generative recommendation and advertising [8, 10]. ETGRec couples item tokenization and generative recommendation through recommendation-oriented alignment, whereas DIGER allows the generative recommendation objective to influence Semantic-ID learning through differentiable assignments [3, 17].

The same discrete interface has also been adopted by discriminative recommenders, where semantic codes enter as categorical fields and are converted into task-specific representations through embedding lookups. Better Generalization with Semantic IDs freezes a content-based RQ-VAE and learns representations of the resulting code sequences in an industrial ranking model [27]. UIST quantizes user and item semantics and introduces hierarchy-aware interactions between their token sequences [18]. UserIP applies vector quantization to LLM-inferred user profiles and couples profile learning with recommendation supervision [21]. Other methods introduce behavioral information before or during discretization: QARM aligns multimodal representations before quantization, DAS jointly trains residual quantization and collaborative alignment, and SaviorRec uses fixed RQ assignments to index a trainable behavior-alignment adapter [22, 44, 45]. RQ-GMM improves residual discretization through probabilistic distribution modeling, while TokenMinds generates discrete user-interest tokens together with dense user embeddings for production ranking systems [19, 29]. These studies demonstrate that alignment and tokenization describe different design dimensions: alignment determines how behavioral supervision shapes a representation, whereas tokenization determines how that representation is exposed to the downstream recommender. Recent studies have also reconsidered how much of a hierarchical token sequence to use. UIST learns soft interactions among different hierarchy levels, whereas TokenMinds adopts a globally selected token prefix [18, 19]. In generative recommendation, SA²CRQ, VarLenRec, and CapsID construct variable-length item identifiers using signals such as path entropy, item popularity, or routing confidence [1, 32, 34]. These methods adapt the identifier length at the item level for generative retrieval. OptST instead studies post-pretraining adaptation for a discriminative downstream recommender. It keeps the semantic encoder and base RQ codebooks frozen, uses the downstream recommendation objective to adapt the effective assignment geometry under low-rank and anchor constraints, and selects the token-prefix depth for each user–item interaction.

Preliminaries

Recommendation with Semantic Profiles

Let U\mathcal{U} and I\mathcal{I} denote the user and item sets. We consider a dataset D={(ui,yi)}\mathcal{D}=\{(u_i,y_i)\} of user–item pairs. The label yi∈{0,1}y_i \in\{0,1\} indicates whether (u,i)(u,i) is a positive or negative recommendation instance under the adopted data construction. Each pair is associated with structured feature vectors xui\mathbf{x}_{ui}, including user and item identifiers and other available fields. In addition, an offline LLM-based profiling pipeline converts the available interaction history of user uu into a dense semantic profile embedding pu∈Rdpp_u \in\mathbb{R}^{d_p}. This profiling pipeline remains fixed during downstream training.

Given the structured features and a token-derived semantic representation suis_{ui}, a recommender fθf_\theta predicts a relevance score

y^ui=fθ(xui,sui)∈(0,1).(1)\hat{y}_{ui} = f_\theta(x_{ui}, s_{ui}) \in(0,1). \tag*{(1)}

Candidate items can then be ranked according to y^ui\hat{y}_{ui}. We train the model using binary cross-entropy:

Lrec=−1∣D∣∑(u,i,yui)∈D[yuilog⁡y^ui+(1−yui)log⁡(1−y^ui)].(2)\mathcal{L}_{\mathrm{rec}} = -\frac{1}{|\mathcal{D}|}\sum_{(u,i,y_{ui})\in\mathcal{D}} \left[y_{ui}\log\hat{y}_{ui} + (1-y_{ui})\log(1-\hat{y}_{ui})\right]. \tag*{(2)}

Pretrained Residual Semantic Tokenizer

A residual-quantized variational autoencoder (RQ-VAE) [12, 30] is pretrained to reconstruct the semantic profile embeddings. Its encoder gϕ0g_{\phi_0} maps each profile embedding to a latent representation zu=gϕ0(pu)∈Rdz_u = g_{\phi_0}(p_u) \in\mathbb{R}^{d}. The tokenizer contains LL base codebooks C0={Cℓ0}ℓ=1L\mathcal{C}^{0} = \{\mathcal{C}^{0}_{\ell}\}_{\ell=1}^{L}, where Cℓ0={cℓ,10,…,cℓ,K0}\mathcal{C}^{0}_{\ell} = \{c^{0}_{\ell,1}, \ldots, c^{0}_{\ell,K}\} contains KK codewords at layer ℓ\ell. After pretraining, the encoder and base codebooks remain frozen. The decoder is not used during downstream recommendation.

Starting from ru,00=zur^{0}_{u,0}=z_u, residual quantization recursively selects a codeword and updates the remaining residual:

ku,ℓ0=arg⁡min⁡k∈{1,…,K}∥ru,ℓ−10−cℓ,k0∥22,ru,ℓ0=ru,ℓ−10−cℓ,ku,ℓ00.(3)k^{0}_{u,\ell} = \underset{k \in\{1,\ldots,K\}}{\arg\min}\left\|r^{0}_{u,\ell-1}-c^{0}_{\ell,k}\right\|_{2}^{2}, \qquad r^{0}_{u,\ell}=r^{0}_{u,\ell-1}-c^{0}_{\ell,k^{0}_{u,\ell}}. \tag*{(3)}

The resulting sequence ku0=(ku,10,…,ku,L0)k^{0}_{u}=(k^{0}_{u,1},\ldots,k^{0}_{u,L}) forms the semantic tokens of user uu. Successive layers encode the residual left by earlier layers and therefore provide progressively finer information.

The RQ codebooks and the embedding tables used by the downstream recommender have different roles. A codeword cℓ,k0∈Rdc^{0}_{\ell,k}\in\mathbb{R}^{d} lies in the tokenizer latent space and determines which index is assigned to a profile. A separate trainable table Eℓ∈RK×dsE_{\ell}\in\mathbb{R}^{K\times d_s} maps the assigned index to the feature Eℓ[k]E_{\ell}[k] consumed by the recommender. Updating EℓE_{\ell} changes how an assigned token is represented downstream, but it does not change which profiles receive that token.

Problem Formulation

Our goal is to adapt a pretrained semantic tokenizer using downstream recommendation supervision while retaining its pretrained semantic structure. The encoder gϕ0g_{\phi_0} and base codebooks C0\mathcal{C}^{0} remain frozen. Let φ\varphi denote the trainable parameters used to construct the effective codebooks C~(φ)\widetilde{\mathcal{C}}(\varphi) around C0\mathcal{C}^{0}. Replacing the base codebooks in Equation (3) with the effective codebooks produces the adapted user-level assignment ku,ℓ(φ)k_{u,\ell}(\varphi) at layer ℓ\ell.

The semantic resolution used by the recommender may depend on the current user–item pair. A gate with parameters ω\omega therefore selects a prefix of the token sequence. Let γui,ℓ∈{0,1}\gamma_{ui,\ell}\in\{0,1\} indicate whether layer ℓ\ell is included for pair (u,i)(u,i). We impose γui,1=1\gamma_{ui,1}=1 and γui,ℓ+1≤γui,ℓ\gamma_{ui,\ell+1}\leq\gamma_{ui,\ell} so that the selected tokens form a valid prefix. The selected depth DuiD_{ui} and semantic input suis_{ui} are

Dui=∑ℓ=1Lγui,ℓ,sui=∑ℓ=1Lγui,ℓEℓ[ku,ℓ(φ)].(4)D_{ui}=\sum_{\ell=1}^{L}\gamma_{ui,\ell}, \qquad s_{ui}=\sum_{\ell=1}^{L}\gamma_{ui,\ell}E_{\ell}[k_{u,\ell}(\varphi)]. \tag*{(4)}

where EℓE_{\ell} is the trainable downstream token embedding table at layer ℓ\ell.

We optimize the recommender, effective-codebook parameters, token embedding tables, and depth gate through

min⁡θ,φ,ω,{Eℓ}ℓ=1LLrec+λaLanchor+λdLdepth,(5)\min_{\theta,\varphi,\omega,\{E_{\ell}\}_{\ell=1}^{L}} \mathcal{L}_{\mathrm{rec}}+\lambda_a\mathcal{L}_{\mathrm{anchor}}+\lambda_d\mathcal{L}_{\mathrm{depth}}, \tag*{(5)}

where θ\theta denotes the recommender parameters, Lanchor\mathcal{L}_{\mathrm{anchor}} constrains deviation from the frozen base codebooks, and Ldepth\mathcal{L}_{\mathrm{depth}} penalizes excessive prefix depth. The nonnegative coefficients λa\lambda_a and λd\lambda_d control the strengths of the two regularizers. § 4 presents the effective-codebook parameterization and the optimization of the discrete assignments and prefix decisions.

Methodology

Overview

Figure 2 presents OptST. Starting from a frozen pretrained encoder and frozen base codebooks, OptST adapts the residual token assignments and selects the token prefix used for each user–item pair. The selected indices are mapped through separate trainable lookup tables and combined with the structured features in the downstream recommender.

Figure 2. Overview of OptST. Frozen pretrained codebooks anchor token assignment adaptation, while an interaction-conditioned gate selects the token prefix used by the downstream recommender.

The first challenge is to make the assignment geometry responsive to downstream recommendation supervision while constraining its deviation from the pretrained geometry. OptST constructs each effective codebook through a near-identity low-rank transformation of its frozen base codebook. It retains hard nearest-code assignment in the forward pass and uses a soft relaxation to propagate recommendation gradients in the backward pass. An anchor regularizer further constrains the resulting geometric deformation.

The second challenge is to select how much residual detail is exposed for each user–item interaction. OptST introduces an interaction-conditioned gate that makes a hard stop-or-continue decision after each quantization layer. A straight-through relaxation enables gate optimization, while a depth regularizer discourages selecting unnecessarily long prefixes. Notice that the downstream recommendation loss provides supervision for both adaptation mechanisms. The token lookup tables and recommender are optimized in the same training process.

Constrained Token Assignment Adaptation

The token assignments are determined by the geometry of the codebooks in the RQ latent space. Updating every codeword independently would introduce KdKd trainable parameters at each layer and allow the effective geometry to move freely from its pretrained initialization. We instead restrict the downstream adaptation through a layer-wise low-rank transformation of the frozen base codebook.

Low-rank effective codebooks. Let Cℓ0∈RK×d\mathcal{C}^{0}_{\ell}\in\mathbb{R}^{K\times d} denote the frozen base codebook at layer ℓ\ell, where KK is the number of codewords and dd is their dimension. Inspired by low-rank adaptation [9], we construct the effective codebook as

C~ℓ=Cℓ0+Cℓ0UℓVℓ=Cℓ0(Id+UℓVℓ),(6)\widetilde{\mathcal{C}}_{\ell}=\mathcal{C}^{0}_{\ell}+\mathcal{C}^{0}_{\ell}U_{\ell}V_{\ell}=\mathcal{C}^{0}_{\ell}(I_d+U_{\ell}V_{\ell}), \tag*{(6)}

where Uℓ∈Rd×rU_{\ell}\in\mathbb{R}^{d\times r} and Vℓ∈Rr×dV_{\ell}\in\mathbb{R}^{r\times d} are trainable factors, r≪dr\ll d is the adaptation rank, and IdI_d is the identity matrix. The collection φ={Uℓ,Vℓ}ℓ=1L\varphi=\{U_{\ell},V_{\ell}\}_{\ell=1}^{L} corresponds to the effective-codebook parameters introduced in Section 3.

We initialize VℓV_{\ell} to zero, giving C~ℓ=Cℓ0\widetilde{C}_{\ell}=C_{\ell}^{0} at the beginning of downstream training. The same transformation is applied to all codewords within a layer, so the adaptation introduces only 2dr2dr trainable parameters per layer, independently of KK. This shared parameterization couples the movement of the codewords and biases the update toward a coherent deformation of the layer-wise assignment geometry.

Geometry anchoring. The shared low-rank transformation restricts the number of trainable parameters, but it does not directly bound how far the effective codebooks may move during recommendation training. We therefore regularize the effective geometry with respect to the frozen base codebooks. Let c~ℓ,k\widetilde{c}_{\ell,k} and cℓ,k0c_{\ell,k}^{0} denote the kk-th codewords in C~ℓ\widetilde{C}_{\ell} and Cℓ0C_{\ell}^{0}, respectively. Their pairwise cosine similarities are defined as

ρ~ℓ,km=cos⁡(c~ℓ,k,c~ℓ,m),ρℓ,km0=cos⁡(cℓ,k0,cℓ,m0),(7)\widetilde{\rho}_{\ell,km}=\cos(\widetilde{c}_{\ell,k},\widetilde{c}_{\ell,m}), \qquad\rho_{\ell,km}^{0}=\cos(c_{\ell,k}^{0},c_{\ell,m}^{0}), \tag*{(7)}

where cos⁡(⋅,⋅)\cos(\cdot,\cdot) denotes cosine similarity. For each codeword kk, let Nℓ,k(J)\mathcal{N}_{\ell,k}^{(J)} contain its JJ nearest neighbors computed once from the frozen codebook at layer ℓ\ell. We define the anchor loss as

Lanchor=1L∑ℓ=1L[∥C~ℓ−Cℓ0∥F2Kd+1KJ∑k=1K∑m∈Nℓ,k(J)[ρ~ℓ,km−ρℓ,km0−ϵa]+],(8)\mathcal{L}_{\mathrm{anchor}}=\frac{1}{L}\sum_{\ell=1}^{L}\left[\frac{\left\lVert\widetilde{C}_{\ell}-C_{\ell}^{0}\right\rVert_{F}^{2}}{Kd}+\frac{1}{KJ}\sum_{k=1}^{K}\sum_{m\in\mathcal{N}_{\ell,k}^{(J)}}\left[\widetilde{\rho}_{\ell,km}-\rho_{\ell,km}^{0}-\epsilon_{a}\right]_{+}\right], \tag*{(8)}

where ∥⋅∥F\left\lVert\cdot\right\rVert_{F} denotes the Frobenius norm, JJ is the number of pretrained neighbors considered for each codeword, ϵa≥0\epsilon_{a}\geq0 is a similarity margin, and [x]+=max⁡(0,x)\left[x\right]_{+}=\max(0,x) is the positive-part operator. The first term limits the overall displacement of the effective codebooks. The second term penalizes a pretrained neighbor pair only when its cosine similarity increases beyond the margin, thereby discouraging excessive local contraction. This regularizer does not force the pretrained geometry to remain unchanged; it keeps the frozen codebooks as explicit references while allowing recommendation supervision to adjust the assignment boundaries.

Straight-through assignment. The effective codebooks can respond to recommendation supervision only if the training signal reflects how the assignment boundaries should change. However, nearest-code selection returns a discrete index and provides no ordinary gradient that compares the selected codeword with alternative assignments. We address this issue with a straight-through estimator that preserves hard tokenization during the forward pass and uses soft assignment only during backward optimization.

At layer ℓ\ell, let ru,ℓ−1∈Rdr_{u,\ell-1}\in\mathbb{R}^{d} denote the residual of user uu before quantization. We compute the distance from this residual to every effective codeword as

δu,ℓ,k=∥ru,ℓ−1−c~ℓ,k∥2,k∈{1,…,K},(9)\delta_{u,\ell,k}=\left\lVert r_{u,\ell-1}-\widetilde{c}_{\ell,k}\right\rVert_{2}, \qquad k\in\{1,\ldots,K\}, \tag*{(9)}

where c~ℓ,k\widetilde{c}_{\ell,k} is the kk-th codeword in the effective codebook C~ℓ\widetilde{C}_{\ell}. The hard assignment and residual update are

ku,ℓ=arg⁡min⁡k∈{1,…,K}δu,ℓ,k,ru,ℓ=ru,ℓ−1−c~ℓ,ku,ℓ.(10)k_{u,\ell}=\arg\min_{k\in\{1,\ldots,K\}}\delta_{u,\ell,k}, \qquad r_{u,\ell}=r_{u,\ell-1}-\widetilde{c}_{\ell,k_{u,\ell}}. \tag*{(10)}

To obtain a differentiable surrogate, we normalize the negative distances over all KK codewords:

qu,ℓ,k=exp⁡(−δu,ℓ,k/τ)∑j=1Kexp⁡(−δu,ℓ,j/τ),(11)q_{u,\ell,k}=\frac{\exp(-\delta_{u,\ell,k}/\tau)}{\sum_{j=1}^{K}\exp(-\delta_{u,\ell,j}/\tau)}, \tag*{(11)}

where qu,ℓ,kq_{u,\ell,k} is the soft assignment weight of codeword kk and τ>0\tau>0 is the assignment temperature. Each layer maintains a trainable lookup table Eℓ∈RK×dsE_{\ell}\in\mathbb{R}^{K\times d_{s}}, where dsd_{s} is the dimension of the token feature used by the recommender. The hard and soft token features are

tu,ℓh=Eℓ[ku,ℓ],tˉu,ℓ=∑k=1Kqu,ℓ,kEℓ[k],(12)t^{\mathrm{h}}_{u,\ell} = E_{\ell}[k_{u,\ell}], \qquad\bar{t}_{u,\ell} = \sum_{k=1}^{K} q_{u,\ell,k} E_{\ell}[k], \tag*{(12)}

where the superscript h denotes the hard lookup and tˉu,ℓ\bar{t}_{u,\ell} denotes its soft relaxation.

The feature passed to the subsequent computation is

t^u,ℓ=tˉu,ℓ+sg⁡(tu,ℓh−tˉu,ℓ),(13)\hat{t}_{u,\ell} = \bar{t}_{u,\ell} + \operatorname{sg}\left(t^{\mathrm{h}}_{u,\ell} - \bar{t}_{u,\ell}\right), \tag*{(13)}

where sg⁡(⋅)\operatorname{sg}(\cdot) is the stop-gradient operator, which acts as the identity in the forward pass and has zero derivative in the backward pass. Consequently, t^u,ℓ\hat{t}_{u,\ell} equals the hard lookup tu,ℓht^{\mathrm{h}}_{u,\ell} during forward computation, while its backward gradient follows the soft feature tˉu,ℓ\bar{t}_{u,\ell}. Because the soft weights depend on the distances to all effective codewords, the recommendation loss provides a surrogate signal to the assignment geometry and the low-rank factors that construct it.

Interaction-Conditioned Prefix Selection

Residual quantization produces an LL-layer token sequence for each user. Exposing all LL layers to every recommendation instance fixes the semantic resolution across user–item pairs. We instead allow the downstream representation to use a pair-specific prefix. The token assignments ku,ℓk_{u,\ell} remain determined by the user profile, while the prefix is conditioned on the current user–item interaction.

Stop-or-continue gate. After each layer ℓ∈{1,…,L−1}\ell\in\{1,\ldots,L-1\}, a lightweight gating network determines whether the next residual layer should be included. The gate summarizes the current quantization state through

vu,ℓ=[∥ru,ℓ∥2, log⁡∥ru,ℓ∥2+ϵnum∥ru,0∥2+ϵnum, cos⁡(ru,ℓ,c~ℓ,ku,ℓ), μu,ℓ]T,(14)\mathbf{v}_{u,\ell} = \left[\left\lVert\mathbf{r}_{u,\ell} \right\rVert_{2},\ \log\frac{\left\lVert\mathbf{r}_{u,\ell} \right\rVert_{2}+\epsilon_{\mathrm{num}}}{\left\lVert\mathbf{r}_{u,0} \right\rVert_{2}+\epsilon_{\mathrm{num}}},\ \cos(\mathbf{r}_{u,\ell},\tilde{\mathbf{c}}_{\ell,k_{u,\ell}}),\ \mu_{u,\ell}\right]^{\mathsf{T}}, \tag*{(14)}

where vu,ℓ∈R4\mathbf{v}_{u,\ell} \in\mathbb{R}^{4} is the quantization-state vector and ϵnum>0\epsilon_{\mathrm{num}} > 0 is a numerical stabilizer. Its first two components measure the remaining residual and its magnitude relative to the initial latent representation. The third component measures the directional relation between the residual and the selected effective codeword.

The final component μu,ℓ\mu_{u,\ell} measures the separation between the two closest codewords:

μu,ℓ=δu,ℓ(2)−δu,ℓ(1)δu,ℓ(1)+ϵnum,(15)\mu_{u,\ell} = \frac{\delta^{(2)}_{u,\ell}-\delta^{(1)}_{u,\ell}}{\delta^{(1)}_{u,\ell}+\epsilon_{\mathrm{num}}}, \tag*{(15)}

where δu,ℓ(1)\delta^{(1)}_{u,\ell} and δu,ℓ(2)\delta^{(2)}_{u,\ell} are the smallest and second-smallest values among the distances {δu,ℓ,k}k=1K\{\delta_{u,\ell,k}\}_{k=1}^{K} defined in Equation (9). A larger μu,ℓ\mu_{u,\ell} indicates greater separation between the selected codeword and its nearest alternative.

For either a user or an item, let xx denote the entity and let Xtr\mathcal{X}_{\mathrm{tr}} denote the corresponding set of training users or items. We define its centered log-frequency feature as

ϕx=log⁡(1+nx)−Ex′∼Xtr[log⁡(1+nx′)],(16)\phi_x = \log(1+n_x) - \mathbb{E}_{x'\sim\mathcal{X}_{\mathrm{tr}}}\left[\log(1+n_{x'})\right], \tag*{(16)}

where nxn_x is the number of training interactions associated with entity xx, and the expectation is the empirical mean over Xtr\mathcal{X}_{\mathrm{tr}}. Substituting x=ux=u and x=ix=i gives the user feature ϕu\phi_u and item feature ϕi\phi_i, respectively.

The complete gate input is

hui,ℓ=[vu,ℓT, ϕu, ϕi, ℓL]T∈R7,oui,ℓ=Gω(hui,ℓ)∈R2,(17)\mathbf{h}_{u i,\ell} = \left[\mathbf{v}_{u,\ell}^{\mathsf{T}},\ \phi_u,\ \phi_i,\ \frac{\ell}{L}\right]^{\mathsf{T}} \in\mathbb{R}^{7}, \qquad\mathbf{o}_{u i,\ell} = G_{\omega}(\mathbf{h}_{u i,\ell}) \in\mathbb{R}^{2}, \tag*{(17)}

where ℓ/L\ell/L identifies the relative layer position, GωG_{\omega} is the gating network with trainable parameters ω\omega, and oui,ℓ\mathbf{o}_{u i,\ell} contains the logits for the stop and continue decisions.

Straight-through gate decisions. The stop-or-continue decision is discrete, but replacing it with a purely soft mixture would create a mismatch between training and inference. We therefore retain a hard decision in the forward pass and use a soft relaxation only to approximate its gradient.

Let oui,ℓstopo^{\mathrm{stop}}_{u i,\ell} and oui,ℓconto^{\mathrm{cont}}_{u i,\ell} denote the two entries of the gate logits oui,ℓ\mathbf{o}_{u i,\ell}. Their soft probabilities are

πui,ℓ=Softmax⁡(oui,ℓτd)=[πui,ℓstop,πui,ℓcont],(18)\boldsymbol{\pi}_{u i,\ell} = \operatorname{Softmax}\left(\frac{\mathbf{o}_{u i,\ell}}{\tau_d}\right) = \left[\pi^{\mathrm{stop}}_{u i,\ell},\pi^{\mathrm{cont}}_{u i,\ell}\right], \tag*{(18)}

where τd>0\tau_d > 0 is the gate temperature, and πui,ℓstop\pi^{\mathrm{stop}}_{u i,\ell} and πui,ℓcont\pi^{\mathrm{cont}}_{u i,\ell} are the probabilities assigned to the two decisions.

The corresponding hard continue indicator is

gui,ℓh=I[oui,ℓcont≥oui,ℓstop],(19)g^{\mathrm{h}}_{u i,\ell} = \mathbb{I}\left[o^{\mathrm{cont}}_{u i,\ell} \ge o^{\mathrm{stop}}_{u i,\ell}\right], \tag*{(19)}

where I[⋅]\mathbb{I}[\cdot] is the indicator function. Thus, gui,ℓh=1g^{\mathrm{h}}_{u i,\ell}=1 means that quantization continues to layer ℓ+1\ell+1, while gui,ℓh=0g^{\mathrm{h}}_{u i,\ell}=0 means that the token sequence stops after layer ℓ\ell.

We construct the straight-through continue value as

g^ui,ℓ=πui,ℓcont+sg⁡(gui,ℓh−πui,ℓcont).(20)\hat{g}_{u i,\ell} = \pi^{\mathrm{cont}}_{u i,\ell} + \operatorname{sg}\left(g^{\mathrm{h}}_{u i,\ell}-\pi^{\mathrm{cont}}_{u i,\ell}\right). \tag*{(20)}

In the forward pass, g^ui,ℓ\hat{g}_{u i,\ell} equals the binary decision gui,ℓhg^{\mathrm{h}}_{u i,\ell}. In the backward pass, its gradient follows πui,ℓcont\pi^{\mathrm{cont}}_{u i,\ell}. This allows the recommendation and depth losses to shape the gate parameters ω\omega while preserving a discrete token prefix in the forward computation.

Prefix construction and depth regularization. The layer-wise continue decisions must form a prefix: once the gate stops, all subsequent token layers are excluded. We construct the binary prefix indicator as

γui,1=1,γui,ℓ=∏j=1ℓ−1gui,jh,ℓ∈{2,…,L},(21)\gamma_{u i,1}=1,\qquad\gamma_{u i,\ell}=\prod_{j=1}^{\ell-1}g^{\mathrm{h}}_{u i,j},\qquad\ell\in\{2,\ldots,L\}, \tag*{(21)}

where γui,ℓ=1\gamma_{u i,\ell}=1 indicates that layer ℓ\ell is included for pair (u,i)(u,i). The corresponding hard prefix depth is

Dui=∑ℓ=1Lγui,ℓ,(22)D_{u i}=\sum_{\ell=1}^{L}\gamma_{u i,\ell}, \tag*{(22)}

where Dui∈{1,…,L}D_{u i}\in\{1,\ldots,L\} is the number of token layers exposed to the downstream recommender.

To propagate gradients through the prefix construction, we replace each hard continue indicator in Equation (21) with its straight-through counterpart:

γ^ui,1=1,γ^ui,ℓ=∏j=1ℓ−1g^ui,j,ℓ∈{2,…,L}.(23)\widehat{\gamma}_{u i,1}=1,\qquad\widehat{\gamma}_{u i,\ell}=\prod_{j=1}^{\ell-1}\widehat{g}_{u i,j},\qquad\ell\in\{2,\ldots,L\}. \tag*{(23)}

The forward value of γ^ui,ℓ\widehat{\gamma}_{u i,\ell} equals the binary indicator γui,ℓ\gamma_{u i,\ell}, while its backward gradient follows the relaxed gate probabilities. The semantic representation supplied to the recommender is

sui=∑ℓ=1Lγ^ui,ℓt^u,ℓ.(24)s_{u i}=\sum_{\ell=1}^{L}\widehat{\gamma}_{u i,\ell}\widehat{t}_{u,\ell}. \tag*{(24)}

where t^u,ℓ\widehat{t}_{u,\ell} is the straight-through token feature defined in Equation (13). In the forward pass, Equation (24) contains only the hard token lookups within the selected prefix. During training, all LL layers are evaluated and their contributions are masked by γ^ui,ℓ\widehat{\gamma}_{u i,\ell}.

Without an explicit constraint, the gate may default to including every layer. We therefore penalize the normalized prefix depth over a training mini-batch:

Ldepth=1∣B∣∑(u,i,yui)∈B1L∑ℓ=1Lγ^ui,ℓ.(25)\mathcal{L}_{\mathrm{depth}}=\frac{1}{|\mathcal{B}|}\sum_{(u,i,y_{u i})\in\mathcal{B}}\frac{1}{L}\sum_{\ell=1}^{L}\widehat{\gamma}_{u i,\ell}. \tag*{(25)}

where B⊆D\mathcal{B}\subseteq\mathcal{D} is a mini-batch of recommendation instances and ∣B∣|\mathcal{B}| is its size. In the forward pass, the inner sum equals the hard depth DuiD_{u i}. In the backward pass, the straight-through prefix weights provide gradients to the gate. This regularizer discourages the gate from always selecting the full token sequence.

Overall optimization. The complete model is trained using the objective in Equation (5). The recommendation loss is evaluated from the prediction fθ(xui,sui)f_{\theta}(x_{u i},s_{u i}), while the anchor and depth losses are defined in Equations (8) and (25). Downstream training updates the low-rank factors {Uℓ,Vℓ}ℓ=1L\{U_{\ell},V_{\ell}\}_{\ell=1}^{L}, token lookup tables {Eℓ}ℓ=1L\{E_{\ell}\}_{\ell=1}^{L}, gate parameters ω\boldsymbol{\omega}, and recommender parameters θ\theta. The pretrained encoder gϕ0g_{\phi_0} and base codebooks {Cℓ0}ℓ=1L\{C_{\ell}^{0}\}_{\ell=1}^{L} remain frozen, and the pretrained decoder is not used. The assignment temperature τ\tau and gate temperature τd\tau_d control the two gradient relaxations; their settings are reported in § 5.

Experiments

In this section, we conduct experiments to answer the following research questions:

  • RQ1: How does OptST compare with conventional and LLM-enhanced recommendation methods?

  • RQ2: Does OptST provide consistent improvements across different downstream recommendation architectures?

  • RQ3: How do constrained token-assignment adaptation and interaction-conditioned prefix selection contribute to the performance of OptST?

  • RQ4: How robust is OptST to the choice of upstream language model?

  • RQ5: How do the learned token assignments and prefix-selection policies behave under different model configurations?

Experimental Setup

Datasets

We evaluate OptST on Amazon Movies, Amazon Games, and Amazon Clothing from the Amazon Review dataset1, together with the Yelp Open Dataset2. Each recorded rating defines an observed user–item interaction (u,i,rui)(u,i,r_{u i}), where uu, ii, and ruir_{u i} denote the user, item, and rating, respectively. Following previous studies [2, 13, 21], we derive a binary preference label as yui=I[rui>3]y_{u i}=\mathbb{I}[r_{u i}>3], where I[⋅]\mathbb{I}[\cdot] is the indicator function. Ratings above 3 are treated as positive, while ratings of 3 or less are treated as negative. We retain all recorded interactions without sampling additional negative instances from unobserved user–item pairs.

We adopt the data-splitting protocol used in previous studies [21]. Specifically, we use the released split indices, which partition the interactions into training, validation, and test sets with an 8:1:1 ratio. All compared methods use the same split indices. Table 1 reports the dataset statistics and training-set positive rates.

Dataset#Users#Items#InteractionsPos. Rate
Movies7,5067,360441,78371.7%
Yelp27,14720,2661,293,24767.2%
Games24,09710,663190,04375.1%
Clothing38,74022,915177,53780.6%

Table 1. Statistics of the four recommendation datasets. Positive rates are measured on the training partition.

Baselines and Evaluation Metrics

We compare OptST with thirteen baselines from three groups. The shallow feature-interaction models include FFM [11] and AFM [41]. The deep feature-interaction models include AutoInt [28], DeepFM [7], PNN [25], DCN [35], DCNv2 [36], xDeepFM [14], and FinalMLP [23]. The LLM-enhanced methods include LLaCTR [2], which introduces field-level semantic knowledge; KAR [40], which augments user and item features with LLM knowledge; CTRL [13], which aligns semantic and collaborative representations; and UserIP [21], which quantizes inferred user profiles into collaborative IDs.

Following previous studies [7, 35], we evaluate all methods using AUC and LogLoss. AUC measures the ability to distinguish positive interactions from negative ones, whereas LogLoss evaluates the quality of the predicted probabilities. Higher AUC and lower LogLoss indicate better performance.

Implementation Details

We construct semantic profiles after applying the data split. For each user, Qwen3-8B [42] summarizes the reviews and item attributes associated with training interactions. Validation and test interactions are excluded. The frozen all-MiniLM-L6-v2 encoder [38] then maps each summary to a 384-dimensional profile embedding. Profile generation is performed offline, and the resulting embeddings are cached for downstream experiments. The frequency features used by the depth gate are also computed from the training set. The complete prompts and generation settings are provided with our code.3 For fair comparison, all LLM-enhanced methods use Qwen3-8B and are evaluated under the same data split, DCN backbone, and hyperparameter search protocol. Beyond these common settings, each baseline retains its original prompting strategy, semantic representation, and integration mechanism. The controlled representation variants are constructed from the same cached profile embeddings.

All models are implemented in PyTorch and optimized with Adam. The common DCN backbone contains three cross layers and two deep layers, each with width [16, 16]. The ID-embedding dimension is 8. We search the learning rate and weight decay over {10−5,5×10−5,10−4,5×10−4,10−3,5×10−3}\{10^{-5}, 5 \times10^{-5}, 10^{-4}, 5 \times10^{-4}, 10^{-3}, 5 \times10^{-3}\}. Models are trained with a batch size of 2,048 for at most 100 epochs, using early stopping on validation AUC with a patience of 5. The RQ-VAE encoder is a two-layer MLP with a hidden dimension of 128 and ReLU activation, and the decoder uses the mirrored architecture. We use L=8L = 8 quantization layers and select the codebook size KK from {128,256,512}\{128, 256, 512\} and the latent dimension dd from {16,32,64,128}\{16, 32, 64, 128\}. The commitment weight is set to β=0.1\beta= 0.1. Each downstream token lookup table has an embedding dimension of 16, while the depth gate uses a width-16 ReLU hidden layer. We tune the low-rank dimension from {2,4,8,16}\{2, 4, 8, 16\}, along with the depth and anchor regularization weights, on the validation set. The assignment temperature is fixed at 1.0, and the gate temperature is annealed from 1.0 to 0.1 with a decay rate of 0.95 per epoch.

Overall Performance Comparison (RQ1)

Table 2 shows that deep feature-interaction models generally outperform shallow models. This confirms the importance of modeling higher-order relations among recommendation features. LLM-enhanced methods provide further gains, demonstrating that semantic information can complement conventional identifiers and structured fields.

MethodMovies AUC↑Movies LL↓Yelp AUC↑Yelp LL↓Games AUC↑Games LL↓Clothing AUC↑Clothing LL↓
FFM0.81440.48290.71420.59680.65590.65420.55210.7206
AFM0.80790.49590.70600.62060.62030.66560.54190.7324
AutoInt0.81930.45610.73840.54990.73440.49770.61430.4948
DeepFM0.81870.45700.73820.55020.72620.50960.61430.5001
PNN0.81820.45580.73820.55050.73900.49030.61410.5151
DCN0.81950.45480.73800.55070.73680.50090.61600.5072
DCNv20.81990.45330.73940.54920.73840.49450.61950.5102
xDeepFM0.82080.45350.73900.54980.74320.48350.61750.5152
FinalMLP0.81590.46110.73540.55340.72130.50830.60480.5029
LLaCTR0.81680.46100.74120.54920.72830.49340.62790.5203
KAR0.80560.46890.72700.55900.72570.49710.61940.4776
CTRL0.81930.45760.73750.55080.73430.48940.61560.4935
UserIP0.82160.45090.73990.55180.74880.48180.63240.4734
OptST0.8237*0.45100.7420*0.5482*0.7532*0.47800.6380*0.4879

Table 2. Overall performance on four datasets. The three baseline blocks correspond to shallow feature-interaction, deep feature-interaction, and LLM-enhanced methods, respectively. LL denotes LogLoss. Bold and underlined values indicate the best and second-best results. * denotes a statistically significant improvement over the strongest baseline at p<0.05p < 0.05. AUC is evaluated using a one-sided DeLong test, while LogLoss is evaluated using a one-sided paired bootstrap test.

Within the LLM-enhanced group, LLaCTR and UserIP are the strongest baselines. Both establish a tighter connection between semantic information and downstream recommendations. LLaCTR injects field-level semantics into feature interactions, while UserIP represents inferred user profiles as discrete collaborative IDs. OptST achieves the best AUC by going one step further. It allows recommendation supervision to adapt the assignment geometry of a pretrained residual tokenizer. The resulting tokens can preserve distinctions that are useful to the downstream task. The LogLoss results are less uniform, indicating that the primary advantage of OptST lies in discrimination rather than probability calibration.

Transferability Study (RQ2)

To examine whether OptST depends on a particular recommendation architecture, we integrate it with several additional backbones. For each backbone, the downstream adaptation stage is trained separately from the same pretrained tokenizer. Table 3 shows that introducing OptST improves AUC for every backbone across all datasets.

MethodMoviesYelpGamesClothing
AutoInt0.81930.73840.73440.6143
+OptST0.82310.74190.74930.6383
DeepFM0.81870.73820.72620.6143
+OptST0.82290.74180.75000.6323
DCNv20.81990.73940.73840.6195
+OptST0.82370.74180.75030.6370
xDeepFM0.82080.73900.74320.6175
+OptST0.82390.74220.75080.6380
FinalMLP0.81590.73540.72130.6048
+OptST0.82060.73830.74370.6314

Table 3. Compatibility of OptST with different recommendation backbones in terms of AUC.

These backbone models feature interactions in different ways. Some rely on attention mechanisms or explicit cross-network connections, while others use factorization structures or multilayer perceptrons. The consistent improvements indicate that task-aware semantic tokenization complements these different interaction mechanisms. The gains also vary across backbone and dataset combinations. This suggests that the useful token partition depends on the downstream model and recommendation data. Therefore, the results demonstrate the broad compatibility of the OptST framework rather than the direct transfer of a single fixed token set.

Ablation Studies (RQ3)

Component and Adaptation Ablations. Table 4(a) first compares different semantic representations. Flat quantization does not consistently improve over the continuous profile, showing that discretization alone is insufficient. Frozen RQ-VAE performs better than the continuous representation across all datasets, supporting the use of hierarchical residual tokens. Removing either codebook adaptation or prefix selection reduces AUC. Codebook adaptation generally contributes more, while prefix selection provides a smaller complementary benefit. Anchor regularization improves AUC on Movies and Games, whereas the selected full configurations already use λa=0\lambda_a = 0 on Yelp and Clothing. Table 4(b) compares three codebook adaptation strategies while keeping the remaining components unchanged. Free adaptation updates the complete codebook, whereas the additive strategy learns a low-rank residual for individual code entries. The shared strategy instead applies one feature-space transformation to all codewords. It achieves the best AUC with the fewest trainable parameters, supporting the shared transformation as a compact parameterization for downstream adaptation.

VariantMoviesYelpGamesClothing
Continuous Profile0.82060.73840.74490.6299
Frozen VQ-VAE0.82050.74060.74460.6280
Frozen RQ-VAE0.82190.74040.74690.6366
OptST w/o Adapt.0.82270.74190.75070.6371
OptST w/o Gate0.82310.74190.75180.6377
OptST w/o Anchor0.82260.74200.75040.6380
OptST (full)0.82370.74200.75320.6380
StrategyMoviesYelpGamesClothing
Free (KdKd)0.82260.74190.74890.6371
Additive ((K+d)rK+d)r)0.82250.74180.74660.6369
Shared (2dr2dr)0.82370.74200.75320.6380

Table 4. Ablations of model components and codebook adaptation strategies in terms of AUC. The w/o Anchor variant sets λa=0\lambda_a = 0. Parentheses in panel (b) report the number of trainable parameters per RQ layer. Bold and underlined values indicate the best and second-best results, respectively.

Sensitivity to the Upstream LLM (RQ4)

Table 5 examines the effect of changing the LLM used for profile generation. All remaining components and training settings are kept unchanged. Within the Qwen3 family, larger checkpoints produce gradual AUC improvements across the datasets. The differences are nevertheless limited, showing that OptST does not rely on the largest profile generator to remain effective. Llama-2-7B also performs comparably to the Qwen3 models. This indicates that parameter count alone does not determine the usefulness of the generated profiles. We use Qwen3-8B in the main experiments because it provides the strongest overall point estimates.

Model Behavior Analysis (RQ5)

Selected Prefix Depth. Figure 3 shows that the learned prefix distributions differ substantially across datasets. Movies and Yelp favor shorter prefixes. Games concentrates near the full token sequence, while Clothing distributes its selections over a wider range of depths. These patterns show that the gate does not impose one universal prefix length. It can expose a short prefix when coarse token information is sufficient and retain deeper residual tokens when the learned recommendation objective favors them.

Figure 3. Distribution of prefix depths selected by OptST at test time. Each panel corresponds to one dataset. The horizontal axis denotes prefix depth, the vertical axis denotes the proportion of test interactions, and μ\mu denotes the mean selected depth.

Codebook Utilization after Adaptation. Figure 4 reports the normalized selection perplexity at each quantization layer. The adapted tokenizer uses a substantial portion of the codebook across datasets. and layers. Although the utilization patterns vary, the assignments do not become concentrated on only a few entries. The layer-wise behavior is also nonuniform. Most datasets retain or increase code diversity at deeper residual levels, while Clothing exhibits more concentrated usage in its later layers. This difference is consistent with successive RQ layers serving distinct roles across datasets.

Figure 4. Test-set codebook utilization of OptST with DCN (selection perplexity divided by codebook size). Rows: Movies, Yelp, Games, Clothing; columns: L1L_1–L8L_8.

Profile GeneratorMoviesYelpGamesClothing
Qwen3-0.6B0.82300.74140.75010.6365
Qwen3-4B0.82330.74160.75090.6372
Llama-2-7B0.82330.74200.75110.6378
Qwen3-8B0.82370.74200.75320.6380

Table 5. Sensitivity of OptST to the upstream LLM in terms of AUC.

Overall, downstream adaptation changes the token assignments without driving the codebook toward a degenerate solution.

Conclusion

In this paper, we studied how to optimize a semantic tokenizer for LLM-enhanced recommendation. Rather than treating semantic tokens as fixed upstream features, OptST makes their assignment geometry responsive to downstream recommendation supervision. It applies a shared low-rank transformation around the frozen RQ codebooks and constrains deviation from the pretrained geometry. An interaction-conditioned gate further determines how much residual detail is exposed to the recommender. Experiments on four public datasets show that OptST consistently improves AUC over conventional and LLM-enhanced baselines. Its benefits also persist across different recommendation backbones. The ablation results identify codebook adaptation as the main source of improvement, while prefix selection provides a complementary benefit. These findings support task-aware semantic tokenization as an effective interface between LLM-derived profiles and downstream recommendation models. Future work can extend this framework to temporal profile construction and other semantic modalities.

Ethical Considerations

All experiments are conducted offline on four public recommendation benchmarks without production deployment or direct interaction with users. The datasets do not contain names, contact information, or explicitly labeled sensitive attributes, though review text and behavioral histories may still reveal personal preferences. The LLM-generated summaries, embeddings, and semantic tokens derived from these data should not be regarded as anonymized, and the upstream language model may reproduce biases present in the source text. Because the benchmarks do not provide protected-group labels, we do not evaluate subgroup fairness in this work. As with engagement-oriented prediction methods in general, deployment should be mindful of popularity concentration and self-reinforcing feedback loops. Fine-grained user representations could also be repurposed for unintended profiling if access is not properly controlled. Responsible deployment would therefore benefit from subgroup fairness evaluation, profile validation, and appropriate data-governance and user-transparency mechanisms.

References

  1. [1]Wenzhuo Cheng, Menghang Gong, Qixin Guo, Hang Zheng, Zhaobin Yang, Jianguo Luo, and Zhengwei Zheng. 2026. CapsID: Soft-Routed Variable-Length Semantic IDs for Generative Recommendation. arXiv:2605.05096 [cs.IR]. https://arxiv.org/abs/2605.05096
  2. [2]Yu Cui, Feng Liu, Jiawei Chen, Xingyu Lou, Changwang Zhang, Jun Wang, Yuegang Sun, Xiaohu Yang, and Can Wang. 2026. Field Matters: A Lightweight LLM-enhanced Method for CTR Prediction. In WWW. 6365–6376.arxiv.org/abs/2505.14057
  3. [3]Junchen Fu, Xuri Ge, Alexandros Karatzoglou, Ioannis Arapakis, Suzan Verberne, Jeomon M. Jose, and Zhaochun Ren. 2026. Differentiable Semantic ID for Generative Recommendation. In Proceedings of the 49th International ACM SIGIR Conference on Research and Development in Information Retrieval. 369–379.
  4. [4]Zhaolin Gao, Joyce Zhou, Yijia Dai, and Thorsten Joachims. 2025. LangPTune: Optimizing Language-based User Profiles for Recommendation. In CIKM. 707–717.DOI
  5. [5]Binzong Geng, Zhaoxin Huan, Xiaolu Zhang, Yong He, Liang Zhang, Fajie Yuan, Jun Zhou, and Linjian Mo. 2024. Breaking the Length Barrier: LLM-Enhanced CTR Prediction in Long Textual User Behaviors. In SIGIR. 2311–2315.arxiv.org/abs/2403.19347
  6. [6]Daya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Peiyi Wang, Qihao Zhu, Runxin Xu, Ruoyu Zhang, Shirong Ma, Xiao Bi, et al. 2025. DeepSeek-R1-incentivizes reasoning in LLMs through reinforcement learning. Nature 645, 8081 (2025), 633–638.DOI
  7. [7]Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, and Xiquiang He. 2017. DeepFM: A Factorization-Machine based Neural Network for CTR Prediction. In IJCAI. 1725–1731.arxiv.org/abs/1703.04247
  8. [8]Ruining He, Lukasz Heldt, Lichan Hong, Raghunandan H. Keshavan, Shifan Mao, Nikhil Mehta, Zhengyang Su, Alicia Tsai, Yueqi Wang, Shao-Chuan Wang, Xinyang Yi, Lexi Baugher, Baykal Cakici, Ed H. Chi, Cristos Goodrow, Ningren Han, He Ma, Römer Rosales, Abby Van Soest, Devanish Tandon, Su-Lin Wu, Weilong Yang, and Yilin Zheng. 2026. PLUM: Adapting Pre-trained Language Models for Industrial-scale Generative Recommendations. In WWW. 8093–8104.DOI
  9. [9]Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yushi Li, Shean Wang, Lu Wang, and Weizhu Chen. 2022. LoRA: Low-Rank Adaptation of Large Language Models. In ICLR.arxiv.org/abs/2106.09685
  10. [10]Jie Jiang, Xinxun Zhang, Enming Zhang, Yuling Xiong, Jun Zhang, Jingwen Wang, Huan Yu, Yuxiang Wang, Hao Wang, Xiao Yan, and Jiawei Jiang. 2026. End-to-End Semantic ID Generation for Generative Advertisement Recommendation. CoRR abs/2602.10445 (2026).arxiv.org/abs/2602.10445
  11. [11]Junchen Jun, Yong Zhang, Wei-Sheng Chin, and Chih-Jen Lin. 2016. Field-aware Factorization Machines for CTR Prediction. In RecSys. 43–50.
  12. [12]Doyup Lee, Chuheon Kim, Saehoon Kim, Minsu Cho, and Wook-Shin Han. 2022. Autoregressive Image Generation using Residual Quantization. In 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 11513–11522. doi:10.1109/CVPR52688.2022.01123DOI
  13. [13]Xiangyang Li, Bo Chen, Lu Hou, and Ruiming Tang. 2026. CTRL: Connect Collaborative and Language Model for CTR Prediction. ACM Trans. Recomm. Syst. 4, 2 (2026), 20:1–20:23.arxiv.org/abs/2306.02841
  14. [14]Jianxun Lian, Xiaohuan Zhou, Fuzheng Zhang, Zhongxia Chen, Xing Xie, and Guangzhong Sun. 2018. xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems. In KDD. 1754–1763.
  15. [15]Jianghao Lian, Bo Chen, Hangyu Wang, Yunxia Yi, Yanru Qu, Xinyi Dai, Kangning Zhang, Ruiming Tang, Yong Yu, and Weinan Zhang. 2024. ClickPrompt: CTR Models are Strong Prompt Generators for Adapting Language Models to CTR Prediction. In WWW. 3319–3330.
  16. [16]Jianghao Lian, Xinyi Dai, Yunxia Yi, Weiwen Liu, Bo Chen, Hao Zhang, Yong Liu, Chuhan Wu, Xiangyang Li, Chenxu Zhu, Huifeng Guo, Yong Yu, Ruiming Tang, and Weinan Zhang. 2025. How Can Recommender Systems Benefit from Large Language Models: A Survey. ACM Trans. Inf. Syst. 43, 2 (2025), 28:1–28:47.
  17. [17]Enze Liu, Bowen Zheng, Cheng Ling, Lantao Hu, Han Li, and Wayne Xin Zhao. 2025. Generative Recommender with End-to-End Learnable Item Tokenization. In Proceedings of the 48th International ACM SIGIR Conference on Research and Development in Information Retrieval. 729–739.arxiv.org/abs/2409.05546
  18. [18]Qijiong Liu, Hengchang Hu, Jiahao Wu, Jieming Zhu, Min-Yen Kan, and Xiao-Ming Wu. 2024. Discrete Semantic Tokenization for Deep CTR Prediction. In WWW (Companion Volume). 919–922.
  19. [19]Qingyun Liu, Bo Yan, Yang Liu, Ru Yuj Roh, Ekansh Sharma, Likang Yin, Emma Olowo, Min hsuan Tsai, Yuxuan Li, Diego Uribe, Saksham Aggarwal, Siqi Wu, Yuan Hao, Vikas Kedighelli, Lukasz Heldt, Lichan Hong, Li Wei, and Xinyang Yi. 2026. TokenMinds: Pretrained User Tokens and Embeddings for User Understanding in Large Recommender Systems. arXiv:2606.25147 [cs.IR] https://arxiv.org/abs/2606.25147
  20. [20]Qidong Liu, Xiangyu Zhao, Yuhao Wang, Yejing Wang, Zijian Zhang, Yuqi Sun, Xiang Li, Maolin Wang, Pengyue Jia, Chong Chen, Wei Huang, and Feng Tian. 2025. Large Language Model Enhanced Recommender Systems: Methods, Applications and Trends. In KDD (2). 6096–6106.
  21. [21]Yusheng Lu, Zhaocheng Du, Xiangyang Li, Pengyue Jia, Yejing Wang, Weiwen Liu, Yichao Wang, Huifeng Guo, Ruiming Tang, Zhenhua Dong, Yongrui Duan, and Xiangyu Zhao. 2025. Prompt Tuning as User Inherent Profile Inference Machine. In CIKM. 5898–5906.DOI
  22. [22]Xinchen Luo, Jiangxia Cao, Tianyu Sun, Jinkai Yu, Rui Huang, Wei Yuan, Hezheng Lin, Yichen Zheng, Shiyao Wang, Qigen Hu, Changqing Qiu, Jiaq Zhi, Xi Zhang, Zhiheng Yan, Jingming Zhang, Simin Zhang, Mingxing Wen, Zhaojie Liu, and Guorui Zhou. 2025. QARM: Quantitative Alignment Multi-Modal Recommendation at Kuaishou. In Proceedings of the 34th ACM International Conference on Information and Knowledge Management. 5915–5922.
  23. [23]Kelong Mao, Jieming Zhu, Liangcai Su, Guohao Cai, Yuru Li, and Zhenhua Dong. 2023. FinMLP: An Enhanced Two-Stream MLP Model for CTR Prediction. In AAAI. 4552–4560.
  24. [24]Zexuan Qiu, Jieming Zhu, Yankai Chen, Guohao Cai, Weiwen Liu, Zhenhua Dong, and Irwin King. 2024. EASE: Learning Lightweight Semantic Feature Adapters from Large Language Models for CTR Prediction. In CIKM. 4819–4827.DOI
  25. [25]Yanru Qu, Bohui Fang, Weinan Zhang, Ruiming Tang, Minzhe Niu, Huifeng Guo, Yong Yu, and Xiuqiang He. 2019. Product-Based Neural Networks for User Response Prediction over Multi-Field Categorical Data. ACM Trans. Inf. Syst. 37, 1 (2019), 5:1–5:35.
  26. [26]Shankark Rajput, Nikhil Mehta, Anima Singh, Raghunandan Hulikal Keshavan, Trung Vu, Lukasz Heldt, Lichan Hong, Yi Tay, Vinh Q. Tran, Jonah Samost, Maciej Kula, Ed H. Chi, and Mahesh Sathiamoorthy. 2023. Recommender Systems with Generative Retrieval. In NeurIPS.
  27. [27]Anima Singh, Trung Vu, Nikhil Mehta, Raghunandan Keshavan, Maheswaran Sathiamoorthy, Yilin Zheng, Lichan Hong, Lukasz Heldt, Li Wei, Devansh Tandon, Ed Chi, and Xinyang Yi. 2024. Better Generalization with Semantic IDs: A Case Study in Ranking for Recommendations. In Proceedings of the 18th ACM Conference on Recommender Systems. 1039–1044.arxiv.org/abs/2306.08121
  28. [28]Weiping Song, Chence Shi, Zhiping Xiao, Zhijian Duan, Yewen Xu, Ming Zhang, and Jian Tang. 2019. AutoInt: Automatic Feature Interaction Learning via Self-Attentive Neural Networks. In CIKM. 1161–1170.DOI
  29. [29]Ziye Tong, Jiahao Liu, Weimin Zhang, Hongji Ruan, Derick Tang, Zhangpeng Zeng, Qinsong Zeng, Peng Zhang, Tun Lu, and Ning Gu. 2026. RQ-GMM: Residual Quantized Gaussian Mixture Model for Multimodal Semantic Discretization in CTR Prediction. In Proceedings of the 49th International ACM SIGIR Conference on Research and Development in Information Retrieval. 4187–4192.
  30. [30]Aäron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. 2017. Neural Discrete Representation Learning. In NIPS. 6306–6315.arxiv.org/abs/1711.00937
  31. [31]Hangyu Wang, Jianghao Lin, Xiangyang Li, Bo Chen, Chenxu Zhu, Ruiming Tang, Weinan Zhang, and Yong Yu. 2024. FLIP: Fine-grained Alignment between ID-based Models and Pretrained Language Models for CTR Prediction. In RecSys. 94–104.arxiv.org/abs/2310.19453
  32. [32]Huimu Wang, Xingzhi Yao, Yiming Qiu, Qinghong Zhang, Haotian Wang, Yufan Cui, Songlin Wang, Sulang Xu, and Mingming Li. 2026. Towards Efficient and Generalizable Retrieval: Adaptive Semantic Quantization and Residual Knowledge Transfer. In Proceedings of the 49th International ACM SIGIR Conference on Research and Development in Information Retrieval. 4987–4992.
  33. [33]Lu Wang, Di Zhang, Fangkai Yang, Pu Zhao, Jianfeng Liu, Yuefeng Zhan, Hao Sun, Qingwei Lin, Weiwei Deng, Dongmei Zhang, Feng Sun, and Qi Zhang. 2025. LettingGo: Explore User Profile Generation for Recommendation System. In KDD. 2985–2995.arxiv.org/abs/2506.18309
  34. [34]Minhao Wang, Bowen Wu, and Wei Zhang. 2026. Learning Variable-Length Tokenization for Generative Recommendation. arXiv:2605.17779 [cs.LG]. https://arxiv.org/abs/2605.17779
  35. [35]Ruoxi Wang, Bin Fu, Gan Fu, and Mingliang Wang. 2017. Deep & Cross Network for Ad Click Predictions. In ADKDD@KDD. 12:1–12:7.arxiv.org/abs/1708.05123
  36. [36]Ruoxi Wang, Rakesh Shakhnna, Derek Zhu, Yuan Cheng, Sagar Jain, Dong Lin, Lichan Hong, and Ed H. Chi. 2021. DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems. In WWW. 1785–1797.DOI
  37. [37]Wenjie Wang, Honghui Bao, Xinyu Lin, Jizhi Zhang, Yongqi Li, Fuli Feng, See-Kiong Ng, and Tat-Seng Chua. 2024. Learnable Item Tokenization for Generative Recommendation. In CIKM. 2400–2409.arxiv.org/abs/2405.07314
  38. [38]Wenhui Wang, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou. 2020. MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers. In NeurIPS.
  39. [39]Ye Wang, Jiahao Xun, Minjie Hong, Jieming Zhu, Tao Jin, Wang Lin, Haoyuan Li, Linjun Li, Yan Xia, Zhou Zhao, and Zhenhua Dong. 2024. EAGER: Two-Stream Generative Recommender with Behavior-Semantic Collaboration. In KDD. 3245–3254.arxiv.org/abs/2406.14017
  40. [40]Yunjia Xi, Weiwen Liu, Jianghao Lin, Xiaoling Cai, Hong Zhu, Jieming Zhu, Bo Chen, Ruiming Tang, Weinan Zhang, and Yong Yu. 2024. Towards Open-World Recommendation with Knowledge Augmentation from Large Language Models. In RecSys. 12–22.
  41. [41]Jun Xiao, Hao Ye, Xiangnan He, Hanwang Zhang, Fei Wu, and Tat-Seng Chua. 2017. Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks. In IJCAI. 3119–3125.arxiv.org/abs/1708.04617
  42. [42]An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Gao, Chenggen Huang, Chenxu Lv, et al. 2025. Qwen3 technical report. arXiv preprint arXiv:2505.09388 (2025).arxiv.org/abs/2505.09388
  43. [43]Hao Yang, Ziliang Wang, Weijie Bian, and Yifan Zeng. 2023. Practice on Effectively Extracting NLP Features for Click-Through Rate Prediction. In CIKM. 4887–4893.DOI
  44. [44]Yining Yao, Ziwei Li, Shuwen Xiao, Boya Du, Jialin Zhu, Junjun Zheng, Xiangheng Kong, and Yuning Jiang. 2025. Behavior-Rec: Semantic-Behavior Alignment for Cold-Start Recommendation. abs/2508.01375 (2025).arxiv.org/abs/2508.01375
  45. [45]Wencai Ye, Jingjie Sun, Shaoyoun Shi, Peng Wang, Wenjin Wu, and Peng Jiang. 2025. DAS: Dual-Aligned Semantic IDs Empowered Industrial Recommender System. In CIKM. 6217–6224.
  46. [46]Neil Zeghidour, Alejandro Luebs, Ahmed Omran, Jan Skoglund, and Marco Tagliasacchi. 2022. SoundStream: An End-to-End Neural Audio Codec. IEEE ACM Trans. Audio Speech Lang. Process. 30 (2022), 495–507.arxiv.org/abs/2107.03312
  47. [47]Yubin Zhang, Haiming Xu, Guillaume Salha-Galvan, Ruiyan Han, Feiyang Xiao, Yanhua Huang, Li Lin, Yang Luo, and Yao Hu. 2026. DProx: Cold-Start CTR Prediction for Ads and Recommendation at Xiaohongshu with Multimodal LLMs. CoRR abs/2603.01590 (2026).DOI
  48. [48]Bowen Zheng, Yupeng Hou, Hongyu Lu, Yu Chen, Wayne Xim Zhao, Ming Chen, and Ji-Rong Wen. 2024. Adapting Large Language Models by Integrating Collaborative Semantics for Recommendation. In ICDE. 1435–1448.arxiv.org/abs/2311.09049
  49. [49]Jieming Zhu, Mengjun Jin, Qijiong Liu, Zexuan Qiu, Zhenhua Dong, and Xiu Li. 2024. CoST: Contrastive Quantization based Semantic Tokenization for Generative Recommendation. In RecSys. 969–974.arxiv.org/abs/2404.14774

AI tools statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

Code, data, proofs and workflows the authors linked for testing, review and reproduction. These links are part of this work’s metadata and are released under the same license as the rest of that metadata. Valency doesn’t host the files; each keeps the license set where it’s hosted.

Pick where to look, or just type