RecJPQ: Joint PQ for Recommenders
- RecJPQ is a recommendation-oriented adaptation of Joint Product Quantisation that compresses item representations by replacing full embeddings with compact sub-ID tuples.
- It reconstructs item embeddings by concatenating learned sub-embeddings, reducing the dominant parameter count from |I|d to bd and enhancing memory efficiency.
- The method improves inference efficiency through algebraic decomposition, enabling exact top‑k scoring and dynamic pruning in large-catalogue sequential recommendation systems.
RecJPQ is a recommendation-oriented adaptation of Joint Product Quantisation for large-catalogue recommendation, introduced as a replacement for the conventional item embedding tensor in sequential recommenders such as SASRec, BERT4Rec, and GRU4Rec. Its central mechanism is to replace each item’s full embedding with a short tuple of shared sub-item identifiers and to reconstruct the item representation by concatenating learned sub-embeddings, thereby changing the dominant learnable item-side parameter count from to , plus fixed code storage of order (Petrov et al., 2023). In subsequent work, the same representation became the basis for exact parallel scoring, safe dynamic pruning, sub-ID-level popularity modeling, and multimodal top- recommendation (Petrov et al., 2024, Petrov et al., 1 May 2025, Mallamaci et al., 7 Aug 2025, Spillo et al., 22 Jun 2026).
1. Origin and problem formulation
RecJPQ was introduced to address a specific systems bottleneck in sequential recommendation: modern Transformer backbones generate a sequence representation and then score every catalogue item against an item embedding matrix. In the standard formulation, a user history is encoded as , item scores are computed as , and the item matrix becomes the dominant memory cost when reaches hundreds of thousands or millions (Petrov et al., 2024). In the original RecJPQ paper, this bottleneck is framed as affecting both input embedding lookup and output scoring, because the same item embedding tensor is used to represent historical items and to score candidate items (Petrov et al., 2023).
The method is explicitly derived from Product Quantisation and Joint Product Quantisation. Standard PQ splits a vector into subspaces and approximates each subvector by a centroid from a small codebook; JPQ differs in assigning codes before end-to-end training so that the model never needs to learn the full dense embedding table. RecJPQ transfers that idea to recommendation and adds recommendation-specific code assignment strategies based on interaction data rather than text-side pretraining (Petrov et al., 2023).
The original paper also presents RecJPQ as conceptually analogous to tokenisation in LLMs: items are split into “sub-item entities” before recommender training. This framing is not merely metaphorical. It captures the core inductive bias of the method: parameter sharing is imposed at the level of discrete latent components rather than learned post hoc by compression (Petrov et al., 2023).
2. Compositional representation and code assignment
In RecJPQ, each item receives a code
where 0 is the code length and each 1 is a sub-item ID drawn from a split-specific codebook of size 2. The scheme can therefore represent up to 3 distinct item codes. With the common setting 4, each code component fits in one byte (Petrov et al., 2023).
For each split 5, RecJPQ learns a sub-item embedding table of dimension 6. The item embedding is reconstructed by concatenating the selected sub-embeddings. Later formalizations write this as
7
with codebook matrix
8
and split-specific sub-item embedding matrices
9
If the sequence embedding is partitioned compatibly as 0, then item scoring decomposes additively: 1 Defining sub-ID scores
2
one obtains the operational scoring identity
3
This is the algebraic basis of all later RecJPQ inference work (Petrov et al., 2024).
The learnable parameter reduction follows directly. A standard item table needs 4 trainable parameters. RecJPQ replaces this with 5 learnable parameters, while storing the discrete item-to-code assignments separately (Petrov et al., 2023).
The original paper defines three offline assignment strategies. The simplest is random code assignment. The main recommendation-specific strategy is discrete truncated SVD: construct the binary sequence–item interaction matrix 6, compute truncated SVD with 7 latent components,
8
min-max normalize the item matrix 9, perturb it with tiny Gaussian noise 0, and discretize each latent dimension into 1 quantiles; those quantized values become the item’s sub-item IDs. A third strategy applies the same discretization pipeline to item embeddings learned by an offline BPR matrix factorization model (Petrov et al., 2023).
3. Integration into recommendation architectures
RecJPQ is presented as a model-agnostic replacement for the item embedding tensor rather than a new sequence encoder. In the original formulation, SASRec retains its self-attention sequence model, BERT4Rec retains its bidirectional Transformer encoder, and the GRU-based baseline retains its recurrent backbone; what changes is the way item representations are stored, looked up, and reused for output scoring (Petrov et al., 2023).
This replacement is deliberately lightweight at the training-objective level. The original paper states that RecJPQ does not modify the base model loss. BERT4Rec continues to use its original masked-item prediction objective, SASRec its original next-item objective, and the GRU-based model the LambdaRank configuration of the authors’ prior implementation. The compression is therefore architectural rather than loss-based (Petrov et al., 2023).
This design choice remained stable in later work. The PQTopK paper explicitly states that RecJPQ changes the item representation layer while PQTopK changes only the inference-time scoring head; the Transformer backbone and learning objective are not altered (Petrov et al., 2024). The same modularity underlies later extensions such as sub-ID popularity re-ranking and multimodal quantization.
A notable generalization appears in URecJPQ, which extends the RecJPQ idea from item-only quantization in sequential recommendation to user-and-item quantization in top-2 recommendation. In that setting, a vanilla model with embedding dimension 3 has 4 trainable embedding parameters, whereas URecJPQ reduces the trainable embedding component to shared codebooks of size 5 per side, or 6 for both users and items when the codebook length is 256 per subspace (Spillo et al., 22 Jun 2026).
4. Empirical behavior and regularization
The original RecJPQ evaluation used MovieLens-1M, Booking.com, and Gowalla. Its central empirical pattern is that RecJPQ is most compelling on large, sparse, long-tail catalogues. On Booking.com, BERT4Rec with SVD-based RecJPQ improved NDCG@10 from 7 to 8 while reducing model size to 9 of the baseline, which the paper highlights as a 0 NDCG@10 improvement. On Gowalla, base SASRec achieved NDCG@10 1, while RecJPQ-Random achieved 2 at 3 of the original checkpoint size (Petrov et al., 2023).
The same study reports a clear size–performance frontier. On MovieLens-1M, the largest vanilla SASRec reaches roughly the same performance as a 4 smaller RecJPQ variant, 5 MB versus 6 MB. On Gowalla, comparable SASRec performance is reported with a 7 smaller RecJPQ model, 8 GB versus 9 MB (Petrov et al., 2023). The paper also reports that training and inference time were not noticeably harmed in its setting; on Booking.com, base BERT4Rec required 0 hours while RecJPQ-SVD BERT4Rec required 1 hours (Petrov et al., 2023).
The original paper interprets some of the quality gains as a regularization effect. Because many long-tail items have very few interactions, learning a fully independent dense vector per item can overfit. RecJPQ forces items to share sub-embeddings, reducing memorization of idiosyncratic item-specific parameters and improving generalization on sparse data (Petrov et al., 2023). The ablations support this interpretation: longer codes, hence weaker sharing, help on denser MovieLens-1M, whereas shorter codes, hence stronger sharing, help on sparse long-tail Gowalla (Petrov et al., 2023).
This regularization reading reappears in later work. URecJPQ reports that on large-scale multimodal datasets it can reduce checkpoint size by 2 to 3 and trainable parameters by 4 to 5, with an average decrease of 6 in Recall and 7 in NDCG, but in some cases even performance improvements of up to 8, especially in the baby-products domain (Spillo et al., 22 Jun 2026).
5. Inference, pruning, and system-scale retrieval
The algebraic decomposition of RecJPQ scores led to a second research line focused on exact inference efficiency. The key observation is that one can precompute the 9 sub-ID score matrix 0 once per user and then assemble each item score by 1 lookups and additions rather than by a full 2-dimensional dot product (Petrov et al., 2024).
The PQTopK paper argues that the original RecJPQ implementation left speed on the table because it used per-item score accumulators in a split-first loop order, which limited parallelization. PQTopK reorders the computation so that each item’s final score is computed independently as
3
followed by exact top-4 selection. On Gowalla with 5 items, this reduced SASRec scoring mean response time from 6 ms for default scoring to 7 ms and total inference from 8 ms to 9 ms, yielding the widely cited 0 end-to-end speedup over default SASRec and 1 over the original RecJPQ scoring head (Petrov et al., 2024).
RecJPQPrune extends this line from faster exhaustive scoring to exact non-exhaustive retrieval. It introduces inverted indexes over sub-item IDs, orders sub-ID scores within each split, maintains a top-2 threshold 3, and stops when the upper bound
4
satisfies 5, because no unscored item can then enter the final top 6. The method is described as safe-up-to-rank 7: it returns exactly the same top-8 as exhaustive scoring and preserves effectiveness (Petrov et al., 1 May 2025).
On Tmall with 9M items and SASRecJPQ, the paper reports median scoring times of 0 ms for Transformer Default, 1 ms for PQTopK, and 2 ms for RecJPQPrune, corresponding to about 3 speedup over Transformer Default and about 4 over PQTopK. It also states that RecJPQPrune can score 5 million items in under 6 milliseconds without GPUs and without ANN, while maintaining identical NDCG@10 across scoring methods (Petrov et al., 1 May 2025).
These inference papers also clarify an important misconception. Neither PQTopK nor RecJPQPrune is an approximate nearest-neighbor method in the reported form. PQTopK is still exhaustive, but parallel and sub-ID-based; RecJPQPrune is non-exhaustive, but exact because it prunes only when the provable upper bound on unseen items falls below the current threshold (Petrov et al., 2024, Petrov et al., 1 May 2025).
6. Later extensions, trade-offs, and limitations
Several later papers repurposed the RecJPQ sub-ID structure beyond memory-efficient sequential scoring.
| Work | Focus | Representative reported result |
|---|---|---|
| PQTopK (Petrov et al., 2024) | Parallel exact scoring | 7 faster total SASRec inference on Gowalla |
| RecJPQPrune (Petrov et al., 1 May 2025) | Safe dynamic pruning | 8 faster than Transformer Default on Tmall |
| sPPS (Mallamaci et al., 7 Aug 2025) | Sub-ID popularity re-ranking | higher personalised novelty without compromising recommendation accuracy |
| URecJPQ (Spillo et al., 22 Jun 2026) | User+item quantization for multimodal top-9 | 0–1 checkpoint and 2–3 parameter reduction |
In music recommendation, the sub-ID structure was reinterpreted as a finer-grained popularity signal. If an item has code
4
and the user-specific count of sub-ID 5 in split 6 is
7
then the sub-ID-based personalised popularity score is
8
The final score is a convex combination of the RecJPQ recommender logits, item-level PPS, and sub-ID-level PPS: 9 This extension is intended to capture shared repetition patterns that item-level popularity alone cannot express (Mallamaci et al., 7 Aug 2025).
Across these developments, several limitations remain stable. RecJPQ codes are assigned offline and fixed before training; neither the original paper nor URecJPQ learns the discrete assignments dynamically (Petrov et al., 2023, Spillo et al., 22 Jun 2026). Assignment strategy is materially important: SVD is presented as the safest default in the original sequential setting, Random can be best when stronger regularization helps, and BPR-based discretization can fail badly, as on Gowalla (Petrov et al., 2023). The method is also catalogue-scale sensitive: on small datasets such as MovieLens-1M, compression gains can be limited and overhead can dominate, even increasing SASRec checkpoint size in one reported setting (Petrov et al., 2023).
Inference-side trade-offs are equally explicit. PQTopK remains exhaustive over the candidate set, so latency still scales roughly linearly with 00; its advantage is hardware efficiency and preserved memory compression (Petrov et al., 2024). RecJPQPrune is exact, but its worst-case behavior can approach exhaustive scoring when pruning is ineffective, and larger numbers of splits 01 erode the scoring advantage (Petrov et al., 1 May 2025). URecJPQ emphasizes memory and checkpoint reductions rather than latency, and it does not report explicit retrieval-throughput benchmarks (Spillo et al., 22 Jun 2026).
Taken together, these works establish RecJPQ as more than an embedding-compression trick. In its original form it is a JPQ-inspired compositional item layer for training large-catalogue sequential recommenders; in later work it becomes an exact scoring algebra, a dynamic-pruning substrate, a source of sub-ID-level personalization signals, and a basis for user-and-item quantization in multimodal top-02 systems (Petrov et al., 2023).