sungjin-code/amazon-reviews-for-llm-extended
Cross-domain sequential recommendation dataset A sequential recommendation dataset drawn from Amazon Reviews 2023, covering Books, CDs_and_Vinyl, Movies_and_TV, Video_Games. Each row of interactions.parquet is one user buying or reviewing one item at one time. Users are sampled so that every one of them is active in all domains, their interactions are ordered chronologically and cut into train/valid/test, and each interaction carries a fixed set of 10 candidate items for ranking… See the full description on the dataset page: https://huggingface.co/datasets/sungjin-code/amazon-reviews-for-llm-extended.
Cross-domain sequential recommendation dataset
A sequential recommendation dataset drawn from Amazon Reviews 2023, covering Books, CDsandVinyl, MoviesandTV, Video_Games.
Each row of interactions.parquet is one user buying or reviewing one item at one time. Users are sampled so that every one of them is active in all domains, their interactions are ordered chronologically and cut into train/valid/test, and each interaction carries a fixed set of 10 candidate items for ranking evaluation. Integer user_idx / item_idx columns make the data directly loadable by sequential models, while the original Amazon identifiers are retained so item metadata can be joined back in.
Generated from the raw corpus by the project's build script; the numbers below are read off the published files.
Build configuration
Built with the flags in the table above. The build and audit scripts live in the project repository.
The build is deterministic: identical flags over identical inputs produce byte-identical outputs. Selection, indexing and splitting involve no randomness at all; candidate sampling is the only stochastic step, and it is driven by --seed alone.
Files
Split files carry the split column, so each stays self-describing if moved.
Loading
The parquet files stand alone -- no code from the project repository is needed.
import polars as pl
train = pl.read_parquet("data/train.parquet")
text = pl.read_parquet("data/items_text.parquet") # item_idx -> title, description
row = train.row(0, named=True)
row["candidates"] # the 10 item_idx values to rank
row["item_idx"] # the correct one; row["gt_pos"] is its index in candidates
# A user's history is every earlier position in their own sequence.
inter = pl.read_parquet("data/interactions.parquet")
history = (
inter.filter((pl.col("user_idx") == row["user_idx"]) & (pl.col("pos") < row["pos"]))
.sort("pos")["item_idx"]
.to_list()
)Or through the datasets library, which reads the split configuration above:
from datasets import load_dataset
ds = load_dataset("sungjin-code/amazon-reviews-for-llm-extended") # train / validation / testDownloading only what you need
Every file under data/ is at most a couple of MB, so pulling the whole repo is a reasonable default. To grab less, fetch files individually instead of cloning the repo:
from huggingface_hub import hf_hub_download
# essential: everything the sequential-rec task itself needs
essential = ["train.parquet", "valid.parquet", "test.parquet", "items_text.parquet"]
for name in essential:
hf_hub_download("sungjin-code/amazon-reviews-for-llm-extended", "data/" + name, repo_type="dataset", local_dir=".")For the full version -- adding items_meta.parquet (price, ratings, categories, images, and other fields beyond title/description) and any dataset-specific extras such as graph.parquet -- download the whole data/ folder:
from huggingface_hub import snapshot_download
snapshot_download("sungjin-code/amazon-reviews-for-llm-extended", repo_type="dataset", local_dir=".")Schema of interactions.parquet
Every item carries a non-empty title: an item whose metadata has no title is not eligible, so a text-based ranker never sees a blank candidate. Original string ids travel alongside the integer ids, so items.parquet still joins to items_text.parquet (titles/descriptions) and items_meta.parquet (everything else) on parent_asin. Every item in data/items.parquet resolves in the source corpus metadata.
Split protocol
Each user's interactions are sorted oldest to newest and cut by position:
train= positions[0, floor(0.8n))valid= positions[floor(0.8n), floor(0.9n))test= positions[floor(0.9n), n)
Older interactions are always in the earlier split, so there is no temporal leakage within a user. Splits are contiguous position blocks. Because every user has at least 10 interactions, no split is ever empty.
This is a per-user ratio split, not a global timestamp cut: every user appears in all three splits, which is the usual arrangement for sequential recommendation.
Candidate sets
Every interaction carries a fixed candidate set for ranking evaluation, in the candidates column: the interaction's own item, plus 9 negatives sampled from the same domain as that item.
- Negatives exclude every item the user interacts with anywhere in their sequence, so a true positive is never presented as a negative. The ground truth is one of those excluded items, which makes all 10 candidates distinct by construction.
- The ground truth sits at a uniformly random position, recorded in
gt_pos, so a ranker cannot score well by favouring a fixed slot.candidates[gt_pos] == item_idx. - Sampling is seeded (
--seed 42) and reproducible: the same flags redraw the same sets. Rebuilding with a different seed changescandidatesand nothing else. - Candidates are
item_idxvalues. Joinitems.parquetforparent_asin, thenitems_text.parquetfor titles/descriptions oritems_meta.parquetfor everything else.
Observed ground-truth position counts: 0:351, 1:352, 2:378, 3:389, 4:373, 5:327, 6:379, 7:384, 8:329, 9:339.
Statistics
Known limitations
Item overlap is very low. 3,480 of 3,537 items (98.4%) appear exactly once, and the most popular item appears 4 times. Consequently 98.9% of valid and 97.5% of test interactions target an item that never appears in train.
This matters for how the dataset can be used:
- Methods that score items from their text are unaffected — an LLM ranker reads item titles and descriptions from
items_text.parquetand never needs a trained id embedding, so an item it has never seen is still rankable. - Id-embedding baselines (SASRec, GRU4Rec) cannot be meaningfully evaluated on this build. The correct item has no learned embedding in nearly every evaluation case. Training such a baseline needs a far larger user sample, built by relaxing the cross-domain requirement and the interaction floor. This dataset is small by design, so that running an LLM over every interaction stays affordable.
Candidate sets keep the evaluation well-posed: the ground truth is always one of the 10 candidates, so every interaction has a reachable correct answer, and every candidate carries a real title for a text-based ranker to read.
Other caveats: ratings are filtered to >= 1, so low ratings (1-3 stars) count as real negative signal, alongside implicit negatives from items never interacted with. Users are the most active in the window, so they are not representative of typical Amazon reviewers.
Regenerating
The scripts that build this dataset from the raw Amazon Reviews 2023 dumps, and that audit a build against every property described above, live in the project repository rather than here. They need the source corpus, which is far too large to ship alongside the result.
Source and attribution
Derived from the Amazon Reviews 2023 corpus released by the McAuley Lab at UC San Diego:
- Project page: <https://amazon-reviews-2023.github.io/>
- Source corpus: <https://huggingface.co/datasets/McAuley-Lab/Amazon-Reviews-2023>
- License of the source corpus: <https://github.com/hyp1231/AmazonReviews2023> (Copyright (c) 2024 Yupeng Hou, MIT)
That repository holds the corpus's preprocessing scripts and RecBole benchmark configs. It is referenced here for provenance and licensing only -- this dataset is not in its benchmark format and its scripts will not read these files. The upstream benchmarks use single-domain RecBole .inter files with a leave-one-out split; this dataset is parquet, combines 4 domains, and splits each user's sequence 8:1:1 by position.
If you use this data, cite the source corpus:
@article{hou2024bridging,
title={Bridging Language and Items for Retrieval and Recommendation},
author={Hou, Yupeng and Li, Jiacheng and He, Zhankui and Yan, An and Chen, Xiusi
and McAuley, Julian},
journal={arXiv preprint arXiv:2403.03952},
year={2024}
}User and product identifiers are the pseudonymous ids published in the source corpus; no additional identifying information is introduced here.
License
MIT, matching the upstream corpus. See LICENSE, which carries the upstream copyright notice alongside the grant for this derived work.
