Introduction
Large Language Models (LLMs) have shown immense potential in sequential recommendation (LLM4Rec) by interpreting user histories as natural language. However, two primary bottlenecks hinder their scalability: the limited context window of LLMs and the quadratic computational complexity relative to sequence length. Consequently, most existing LLM4Rec systems truncate user histories to a mere 5–20 recent items, sacrificing long-term behavioral patterns and nuanced user preferences.
The PatchRec Framework
To overcome these limitations, PatchRec introduces a hierarchical compression framework designed to process significantly longer interaction sequences. The core innovation lies in aggregating fine-grained textual tokens into coarser "patches" that retain semantic meaning while reducing the total token count.
Hierarchical Patching
The framework utilizes two levels of abstraction to condense user history:
- Item Patches: Instead of representing an item (e.g., a movie title) with multiple textual tokens, PatchRec uses average pooling to compress token embeddings into a single "item patch" vector.
- Session Patches: To further condense the history, multiple adjacent item patches are aggregated into a "session patch," representing broader behavioral clusters.
Two-Stage Training Strategy
Since LLMs are not natively trained on pooled embeddings, PatchRec employs a two-stage training process:
- Patch Pre-training: The model learns to align raw textual representations with compressed patches by processing both in the same training batch.
- Patch Fine-tuning: The model is trained on "multi-grained" sequences. This mimics human memory: recent interactions are kept as raw text for high precision, middle-range history is compressed into item patches, and distant history is stored as dense session patches.
Experimental Evaluation
The researchers evaluated PatchRec on three benchmark datasets: MovieLens-1M, Goodreads, and MovieLens-100K. The Goodreads dataset was specifically filtered to include users with long interaction histories to test the model's ability to handle extended contexts.
Key Insights
- Information Density: PatchRec often outperforms uncompressed baselines like TALLRec even when the number of items is identical. This suggests that the patching process acts as a noise filter, increasing the "information density" of the input and mitigating the impact of one-off interactions.
- Efficiency as a Performance Driver: By reducing the computational burden, PatchRec can model over three times more user behaviors within the same budget as standard models, leading to a 13% performance boost on MovieLens-1M.
Results and Efficiency
PatchRec demonstrates a superior performance-efficiency trade-off compared to existing baselines. On the Goodreads dataset, the model improved HR@20 by up to 32% compared to the TALLRec baseline.
In terms of efficiency, PatchRec achieved up to a 13.6x compression ratio. For users with extremely long histories (500+ interactions), the session-patch variant (PatchRec-S) delivered a 13.09-fold reduction in inference time while simultaneously improving recommendation accuracy by over 20% compared to truncated baselines. Standard methods required significantly more tokens—PatchRec used only 7.34% of the LLM input tokens required by standard methods for a fixed sequence.
Limitations and Future Directions
While PatchRec significantly reduces token counts, the underlying architecture remains an LLM, posing challenges for real-time deployment at scale. Future work may involve:
- Adaptive Granularity: Dynamically adjusting the compression ratio based on the complexity or volatility of a user's behavior.
- Advanced Compression: Moving beyond simple average pooling to more sophisticated mechanisms like attention-based pooling or learnable Q-formers.
- Model Optimization: Exploring distillation or quantization to further reduce inference latency.
Summary updated