CoolFace
Datasetpublic

sungjin-code/amazon-reviews-for-llm

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.

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes66downloads
Dataset Card

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

SettingValue
DomainsBooks, CDsandVinyl, MoviesandTV, Video_Games
Time window2021-09-01 to 2022-05-01
Minimum rating4
Domains per user>= 4
Interactions per user>= 10
Users sampledtop 100 by interaction count
Item identityparent_asin (must have a title)
Candidates10 per interaction, seed 42
Splitper-user chronological 8:1:1

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

FileRowsContents
data/interactions.parquet3,343every interaction, sorted by (user_idx, timestamp, item_idx)
data/train.parquet2,638interactions where split == "train"
data/valid.parquet324interactions where split == "valid"
data/test.parquet381interactions where split == "test"
data/users.parquet100user_idx, user_id, n_inter, n_domains
data/items.parquet3,285item_idx, parent_asin, domain — join key back to metadata
data/items_text.parquet3,285item titles and descriptions, one row per item
data/items_meta.parquet3,285everything else from the source metadata: price, ratings, categories, images, etc. -- optional, only items_text.parquet is needed for the sequential-rec task itself

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.

python
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:

python
from datasets import load_dataset

ds = load_dataset("sungjin-code/amazon-reviews-for-llm")      # train / validation / test

Downloading 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:

python
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", "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:

python
from huggingface_hub import snapshot_download

snapshot_download("sungjin-code/amazon-reviews-for-llm", repo_type="dataset", local_dir=".")

Schema of interactions.parquet

ColumnTypeMeaning
user_idxUInt320-based contiguous user index; 0 is the most active user
item_idxUInt320-based contiguous item index; contiguous blocks per domain
user_idStringoriginal Amazon reviewer id
asinStringoriginal product id of the reviewed variant
parent_asinStringitem identity; the join key for items_text.parquet / items_meta.parquet
domainStringsource category; a function of item_idx
ratingFloat64star rating, filtered to >= 4
timestampInt64review time, epoch milliseconds UTC
posUInt320-based position in the user's chronological sequence
n_interUInt32total interactions for this user (constant per user)
splitStringtrain / valid / test
candidatesList(UInt32)10 item_idx values to rank; the ground truth is one of them
gt_posUInt8index of the ground truth inside candidates

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 changes candidates and nothing else.
  • Candidates are item_idx values. Join items.parquet for parent_asin, then items_text.parquet for titles/descriptions or items_meta.parquet for everything else.

Observed ground-truth position counts: 0:324, 1:330, 2:338, 3:362, 4:350, 5:308, 6:352, 7:356, 8:311, 9:312.

Statistics

MetricValue
Interactions3,343
Users100
Items3,285
Density1.0177%
Time span2021-09-01 to 2022-04-30
Sequence lengthmin 14 / median 23 / max 449 (mean 33.4)
Split ratio78.9% / 9.7% / 11.4%
DomainInteractionsShareItems`item_idx` range
MoviesandTV1,31339.3%1,2771720–2996
Books1,22736.7%1,2240–1223
CDsandVinyl50315.0%4961224–1719
Video_Games3009.0%2882997–3284

Known limitations

Item overlap is very low. 3,231 of 3,285 items (98.4%) appear exactly once, and the most popular item appears 3 times. Consequently 99.1% of valid and 97.1% 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.parquet and 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 >= 4, so there are no negative signals and no implicit negatives — samplers must draw their own. 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:

bibtex
@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.