Abstract
Deep learning has been widely applied in recommender systems, achieving revolutionary progress. However, most existing methods assume that user and item distributions remain unchanged between training and testing. In real-world scenarios, feature distributions naturally shift, leading to significant performance drops—a challenge known as Out-Of-Distribution (OOD) recommendation. We propose DT3OR, a novel Dual Test-Time-Training framework. In DT3OR, we incorporate a model adaptation mechanism during the test phase to update the recommendation model, allowing it to adapt to shifting user and item features. We propose a self-distillation task and a contrastive task to assist the model in learning both invariant interest preferences and variant characteristics. Experimental results across multiple datasets demonstrate DT3OR's effectiveness compared to state-of-the-art baselines.
Introduction
Traditional recommendation models rely on the Independent and Identically Distributed (I.I.D.) assumption, expecting test data to mirror training data. However, e-commerce and social media environments are inherently dynamic. Users mature, interests evolve, and product contexts change over time. When the underlying data distribution shifts, static models often fail to generalize, resulting in poor recommendations.
To address this, we introduce DT3OR (Dual Test-Time Training for OOD Recommendation). Unlike traditional approaches that attempt to build a perfectly robust model during training, DT3OR adapts the model parameters in real-time during the inference (test) phase. This is the first work to apply Test-Time Training (TTT) strategies to the recommendation domain.
The Challenge of Distribution Shift
Distribution shifts in recommendation systems primarily manifest in two ways:
- User Feature Shift: A user's preferences are not static. For instance, a child interested in toys eventually becomes a teenager interested in sports, and later an adult focused on career and home.
- Item Feature Shift: The context of an item can change seasonally or based on trends. A restaurant might be known for fresh salads in the spring but shift its focus to hot pots in the winter.
Standard models struggle with these shifts because they are constrained by patterns learned during the initial training phase. DT3OR overcomes this by treating the test phase as an opportunity for further refinement.
The DT3OR Framework
DT3OR utilizes two unsupervised surrogate tasks to update the model during the test phase without requiring ground-truth labels (e.g., clicks or purchases).
1. Self-distillation Task
The framework employs a soft K-means clustering algorithm on fused user and item embeddings to identify latent "interest centers." A sharpening function is applied to these cluster assignments to create a target distribution. By minimizing the KL-divergence between the model's current predictions and this sharpened distribution, the model is forced to align user representations with invariant interest patterns, filtering out noise from shifted features.
2. Contrastive Task
To enhance discriminative power, DT3OR identifies high-confidence samples within the same cluster as "positive pairs" and samples from different clusters as "negative pairs." Contrastive learning pulls similar entities together and pushes dissimilar ones apart in the latent space, making the model more resilient to feature drift.
Experimental Evaluation
We evaluated DT3OR across five datasets representing various shifts:
- Synthetic Data: Simulated Gaussian feature shifts.
- Meituan: Temporal shifts (weekday vs. weekend).
- Yelp: Location shifts (geographic regions).
- Amazon-Book & Steam: Long-term temporal shifts in user interests.
Key Results
DT3OR consistently outperformed 11 state-of-the-art baselines, including OOD-specific methods like InvCF and CausPref. On the Meituan dataset, DT3OR improved Recall@50 by 11.56% and NDCG@50 by 8.65% over the best-performing baseline. Stability analysis further confirmed that DT3OR maintains performance even as the degree of distribution shift increases.
Conclusion
DT3OR represents a paradigm shift in recommendation systems by moving from static robustness to dynamic adaptation. By leveraging Test-Time Training through self-distillation and contrastive learning, it effectively bridges the gap between training and real-world testing distributions. Future work will focus on optimizing the number of test-time iterations and improving clustering quality in high-dimensional spaces.
Summary updated