TL;DR
The History-Aware Transformer (HAT) introduces personalization to fashion recommendation by leveraging a shopper's unique purchase history. By stacking two transformer models and training them with a novel combination of contrastive and adaptive margin losses, HAT successfully recommends outfits that are both internally cohesive and tailored to individual style preferences, yielding up to a 19.4% improvement over state-of-the-art baselines.
What Problem Does This Paper Address?
Most automated fashion recommendation systems excel at generic compatibility—answering questions like, "Does this shirt go with these pants?" However, they fail to account for individual taste. A punk rock enthusiast and a corporate executive might both look at the same pair of black boots, but the outfits they want to build around them will look entirely different.
Traditional models recommend outfits based on aggregated user preferences, leading to mainstream, one-size-fits-all suggestions. While some personalized models exist, they often rely heavily on rigid user embeddings or struggle to capture complex item-to-item interactions within an outfit. This paper tackles the challenge of recommending outfits that are simultaneously internally coherent and aligned with a shopper's historical style profile.
Methods
The authors propose the History-aware Transformer (HAT), which utilizes a stacked, two-level transformer architecture:
- Bottom-level Encoder: This layer processes individual item embeddings (derived from pre-trained CLIP vision and text models). It uses a cross-attention mechanism with a learnable query to automatically weight the stylistic importance of different items within a single outfit (e.g., recognizing that a jacket might dictate an outfit's style more than an earring).
- Top-level Encoder: This layer achieves personalization by taking the target outfit's embedding and concatenating it with embeddings from the shopper's purchase history.
To train this architecture effectively, HAT combines three distinct loss functions:
- Focal Loss: A standard loss used to predict general outfit compatibility.
- Supervised Contrastive Loss ($L_{CL}$): This forces the model to cluster outfit embeddings from the same shopper closer together in the latent space, effectively mapping out distinct "style zones" for different users.
- Adaptive Margin Ranking Loss ($L_{AM}$): The model is fed "weak negatives"—curated outfits where exactly one item has been randomly replaced. The loss enforces that a true outfit must score higher than a weak negative by a specific margin. Crucially, this margin is adaptive: it scales based on the attention weight of the swapped item, punishing the model more severely if a highly important item (like a dress) is mismatched compared to a minor one.
Datasets
The model was evaluated on two public fashion datasets:
- IQON3000: Contains 308,747 outfits across 3,568 shoppers, featuring highly variable outfit sizes (2 to 20 items) and 59 distinct categories.
- Polyvore-630: Contains 150,380 outfits across 630 shoppers, where every outfit strictly consists of three items.
To properly test personalization, the authors introduced CP-Hard (Compatibility Prediction Hard) and FITB-Hard (Fill-In-The-Blank Hard) evaluation variants. Instead of comparing a real outfit against a completely randomized one, the "Hard" tasks use negative samples from other shoppers who bought at least one overlapping item, ensuring the baseline compatibility is high but the style profile is wrong for the target user.
Key Insights and Ideas
- The "CP-Random" Illusion: Evaluating personalized models on completely random negative outfits (e.g., matching a tuxedo jacket with a swimsuit) is too easy. Models achieve high scores without actually learning anything about the user's personal style. Testing on "CP-Hard" exposes these gaps.
- Clustering Styles via Contrastive Learning: By treating the shopper ID as a class label for contrastive learning, the model successfully groups historical purchases into distinct visual clusters.
- Not All Swaps Are Equal: Introducing "weak negatives" mimics real-world shopping behavior (where a user looks for a specific item to complete an existing wardrobe). Weighting the margin loss by item importance prevents the model from over-correcting when minor accessories are swapped out.
Key Results
HAT significantly outperformed both non-personalized and personalized baselines across all tasks:
- Compatibility Prediction (CP-Hard): HAT achieved a massive performance leap, improving the Area Under the ROC Curve (AUC) by 15.7% on IQON3000 and 19.4% on Polyvore-630 compared to the previous state-of-the-art.
- Fill-In-The-Blank (FITB-Hard): When tasked with choosing the correct missing item out of four choices, HAT improved accuracy by 6.5% (IQON3000) and 9.7% (Polyvore-630).
- Ablation Studies: Removing the contrastive loss ($L_{CL}$) caused a sharp drop in performance, proving that explicitly aligning a user's history in the latent space is vital for effective personalization.
Limitations and Future Work
- No Generative Capability: HAT is a scoring and retrieval model; it can evaluate or complete an outfit from a set of candidates, but it cannot assemble a brand-new outfit from scratch.
- Time-Agnostic History: The model treats all items in a shopper's history equally. In reality, a purchase made last week is a much stronger indicator of current taste than a purchase made three years ago. Incorporating a temporal decay mechanism is a suggested next step.
- Feature Constraints: The model currently only looks at item images and titles. Integrating richer e-commerce data like customer reviews, star ratings, and material information could further refine compatibility predictions.
Summary updated