---
title: "The generative recommender behind Shopify's commerce engine"
description: "Shopify describes a foundational generative recommender that predicts next products, and in some contexts ads, from buyer event sequences spanning searches, views, add-to-carts, favorites, and purchases. The system uses an autoregressive model with causal masking, time-aware attention combining RoPE-inspired rotary encoding with relative attention bias, and sampled softmax with shared and positive-aware hard negatives. Built on HSTU, it combines richer activity data, ensemble-focused training for incremental recall, and optimized CUDA kernels; the full training pipeline reached up to 7.3x the speed of a baseline implementation. In an online test of an August model version, relative shop orders rose 0.94%, high-quality click-through rate rose 5%, conversion rate rose 0.71%, and final served product recall at 2 rose 4.8%."
---

# The generative recommender behind Shopify's commerce engine

[Shopify](https://yomu.fyi/company/shopify) · 2023-10-18 · Feb 25, 2026

**Type:** Explainer

## Summary

Shopify describes a foundational generative recommender that predicts next products, and in some contexts ads, from buyer event sequences spanning searches, views, add-to-carts, favorites, and purchases. The system uses an autoregressive model with causal masking, time-aware attention combining RoPE-inspired rotary encoding with relative attention bias, and sampled softmax with shared and positive-aware hard negatives. Built on HSTU, it combines richer activity data, ensemble-focused training for incremental recall, and optimized CUDA kernels; the full training pipeline reached up to 7.3x the speed of a baseline implementation. In an online test of an August model version, relative shop orders rose 0.94%, high-quality click-through rate rose 5%, conversion rate rose 0.71%, and final served product recall at 2 rose 4.8%.

## Context

Shopify needed recommendations that could interpret complete buyer journeys, including event order, timing, and gaps, across millions of products and billions of events. The system also had to meet real-time production latency and memory constraints while contributing incremental value to an ensemble of retrieval models rather than duplicating their candidates.

## Approach / What changed

The recommender treats recommendation as next-step prediction over raw event sequences using an autoregressive, causally masked model. Shopify combined enriched activity data, HSTU-based architecture, timestamp encodings, relative attention bias, sampled softmax, shared negatives, positive-aware hard negatives, and boosting-inspired training against ensemble weaknesses. Optimized CUDA kernels supported training and serving within resource budgets.

## Takeaways

- Time is encoded directly through a RoPE-inspired rotary encoding and relative attention bias, allowing the model to represent absolute time, time gaps, recency, and the current session timestamp.
- Shared negatives expand the sampled softmax pool across a batch, while positive-aware hard negatives avoid treating potential true positives as negatives and focus learning on informative near misses.
- An August online model test reported relative lifts of 0.94% in shop orders, 5% in high-quality click-through rate, 0.71% in conversion rate, and 4.8% in final served product recall at 2.

**Tags:** [Machine Learning](https://yomu.fyi/topic/machine-learning), [Performance](https://yomu.fyi/topic/performance), [Recommendation Systems](https://yomu.fyi/topic/recommendation-systems), [Scalability](https://yomu.fyi/topic/scalability)

- Source: [Shopify](https://shopify.engineering/generative-recommendations)
- Source URL: https://shopify.engineering/generative-recommendations
- Ingested by Yomu: 2026-08-30T13:18:23.994Z

[Read original post](https://shopify.engineering/generative-recommendations)
