daipham31's picture
Card: task_categories token-classification + text-generation (official list)
a3f9158 verified
|
Raw History Blame Contribute Delete
11.6 kB
metadata
license: apache-2.0
language:
  - en
  - fr
pretty_name: Magento 2 sample-data query rewriting (EN/FR)
task_categories:
  - token-classification
  - text-generation
tags:
  - e-commerce
  - magento
  - query-understanding
  - slot-filling
  - synthetic
size_categories:
  - 10K<n<100K
configs:
  - config_name: default
    default: true
    data_files:
      - split: train
        path: data/default/train.parquet
      - split: validation
        path: data/default/validation.parquet
      - split: test_in_distribution
        path: data/default/test_in_distribution.parquet
      - split: holdout_r2
        path: data/default/holdout_r2.parquet
      - split: holdout_r3
        path: data/default/holdout_r3.parquet
      - split: holdout_r4
        path: data/default/holdout_r4.parquet
      - split: holdout_r7
        path: data/default/holdout_r7.parquet
      - split: holdout_r8
        path: data/default/holdout_r8.parquet
      - split: item5
        path: data/default/item5.parquet
      - split: hard
        path: data/default/hard.parquet
      - split: opener_val
        path: data/default/opener_val.parquet
  - config_name: r7
    data_files:
      - split: train
        path: data/r7/train.parquet
      - split: validation
        path: data/r7/validation.parquet
  - config_name: chat
    data_files:
      - split: examples
        path: data/chat/examples.parquet
  - config_name: chat_dialogues
    data_files:
      - split: dialogues_eval
        path: data/chat/dialogues_eval.parquet

Magento 2 sample-data query rewriting (EN/FR)

English and French shop-search queries, each turned into one short English keyword phrase plus structured filters (gender, colour, size, activity, climate, material, exclusions, price) and, for chat follow-ups, an operation ("show more", "cheaper", "remove the colour", ...). Character spans mark the words behind each value.

The data was used to train a small on-device query rewriter / tagger (Multilingual-MiniLM token classification, ONNX int8) for semantic search on a Magento 2 store running the Luma sample catalog. It contains the exact training, validation and evaluation sets of the model rounds r7, r8 and r8.1 (r8.1 reuses r8's model and data).

from datasets import load_dataset
ds = load_dataset("daipham31/magento2_sampledata_rewrite_query")            # default = r8 / r8.1 data
r7 = load_dataset("daipham31/magento2_sampledata_rewrite_query", "r7")
chat = load_dataset("daipham31/magento2_sampledata_rewrite_query", "chat")
dialogues = load_dataset("daipham31/magento2_sampledata_rewrite_query", "chat_dialogues")

Example row (default/train):

text:        "or in yellow thanks"
target_line: "q: | color: Yellow | op: add"
keywords: null, color: ["Yellow"], op: "add"
spans: [{start: 0, end: 2, label: "OP_ADD", text: "or"}, {start: 6, end: 12, label: "COLOR", text: "yellow"}]

Configs and splits

Config Split Rows EN / FR Used for Clean holdout?
default train 9,756 5,293 / 4,463 r8 / r8.1 training –
default validation 1,640 833 / 807 r8 early stopping and seed choice –
default test_in_distribution 400 204 / 196 eval yes, but same templates as train: optimistic
default holdout_r2 60 30 / 30 eval no: also in the r7 and r8 validation sets
default holdout_r3 60 30 / 30 eval no: in the dev set used to pick the r8 seed
default holdout_r4 60 30 / 30 eval yes
default holdout_r7 60 30 / 30 r7 final holdout, r8 eval yes
default holdout_r8 243 121 / 122 r8 final holdout (template set B) yes
default item5 8 5 / 3 eval (one product request in 8 phrasings) yes
default hard 40 22 / 18 per-epoch dev, eval no: used during training
default opener_val 336 210 / 126 held-out opener phrasings no: part of validation
r7 train 7,688 4,291 / 3,397 r7 training –
r7 validation 1,453 721 / 732 r7 early stopping (includes the 60 holdout_r2 rows) –
chat examples 4,820 2,648 / 2,172 chatbot intents, ops and slot changes; not used to train r7/r8 –
chat_dialogues dialogues_eval 10 dialogues × 3 turns 6 / 4 expected chat state after each turn; never trained on –

Train and validation share no text, and no training text appears in any evaluation split (exact and normalised-text checks). default/validation no longer contains the 60 holdout_r2 rows the model saw during validation; they are in the holdout_r2 split. r7/validation keeps them, exactly as r7 saw it.

Fields (default, r7)

Field Type Meaning
id string split-local id
text string the shopper's query
lang string en or fr
target_line string flat target: q: <keywords> | price: … | gender: … | color: A ; B | size: … | activity: … | climate: … | material: … | not: … | op: … | field: … (fields in this order, only the present ones)
keywords string, null canonical English descriptor + product (warm jacket), null when the query names none
gender, color, size, activity, climate, material list[string] exact catalog labels (see labels/label_values.json)
not_terms list[string] excluded features (hood, zip, logo)
price_min, price_max float, null price bounds. "around X" is stored as 0.8X–1.2X
price_level string, null cheap or expensive (no number)
price_approx bool, null true when the price came from an "around X" span; null when the row has no spans
op string, null chat operation: more, else, cheaper, pricier, reset, undo, remove, replace, add, not
field string, null the attribute a remove names (color, size, price, all, …)
spans list[{start, end, label, text}] character spans with their tag (KW, DESC, COLOR, PRICE_MAX, OP_MORE, …)
spans_status string gold (spans written by the generator) or missing (template rows whose labels were aligned at training time, and rows with no alignable spans, mostly typo rows)
opener, opener_family string, null the conversational opener of the query (I really need, family need)
source_family string tpl, free, free-op, chat-fragment, handwritten, or r8-<family>-A / r8-<family>-B
source_id string original template / family id
generator, seed string, int the script that produced the row and its random seed (null when not recorded)
rounds_used list[string] the model rounds whose train or validation set contains this text (r7, r8, r8.1)
leak_note string, null why a row of an evaluation split is not a clean holdout

Tag sets: labels/tags_r7.json (14 span types, 29 BIO labels) and labels/tags_r8.json (26 span types, 53 BIO labels: r7's plus PRICE_EXPENSIVE, the 10 OP_* tags and FIELD, appended so r7's indices stay valid).

chat/examples has id, text, lang, intent, op, slots, changes_json, target_line, source_id. slots holds the full state after the utterance; changes_json is the slot change as JSON (set, replace, add, clear). chat_dialogues/dialogues_eval (its own config, because its columns differ) has turns: [{msg, intent, op, note, state}]; a symbolic price such as "cheaper than what was shown" is in state.price_rule (price_max=median_of_shown).

How the data was made

No real shopper data. Every query was produced by scripts or written by the developer with an AI coding agent:

  • Templates (tpl, test_in_distribution): a template generator with EN/FR surface forms, French gender agreement, 18 EN and 14 FR openers, about 5 % typos and 4 % negation (seed 13).
  • Free frames (free, free-op): hand-written sentence frames with slots, written by an AI agent and expanded by a generator (seed 7). Each frame is one source_id, so validation holds out whole frames.
  • Store-driven rows (r8-*-A for train/validation, r8-*-B for holdout_r8): generated from the store's own option labels, category names and attribute labels, with price levels, chat operations, remove/replace/add, fit, climate/activity and neutral rows. Set A and set B use different templates.
  • Hand-written evaluation sets: holdout_r2, holdout_r3, holdout_r4, holdout_r7, hard and item5. holdout_r3, holdout_r4 and holdout_r7 were written before the round they measure; in holdout_r2 and holdout_r3 the French rows are translations of the English ones.
  • Labelling rules are in CONVENTIONS.md. Generated values are checked against the catalog vocabulary, and store-driven rows whose spans do not decode back to their target were dropped.

Values are store labels of the Magento Luma sample catalog (for example colour Gray, climate Wintry, activity Crosstraining), so the label set is specific to that catalog.

Reference results

Exact match of the full flat line, EN / FR, of the shipped ONNX int8 tagger, as measured for the r7 → r8 release. r8.1 has the same model and the same scores; only its keyword spelling for the store changed.

Split r7 r8
holdout_r2 ¹ 0.833 / 0.933 0.933 / 0.967
holdout_r3 ¹ 0.833 / 0.833 0.933 / 0.867
holdout_r4 0.967 / 0.900 0.967 / 0.933
holdout_r7 0.867 / 0.733 0.867 / 0.733
dev (hard + holdout_r2 + holdout_r3) ¹ 0.793 / 0.897 0.878 / 0.923
holdout_r8 0.215 / 0.369 0.612 / 0.672
item5 0.40 / 1.0 1.0 / 1.0

¹ Not clean: these rows were used for validation, early stopping or seed choice (see leak_note), so these scores are optimistic. The clean measurements are holdout_r4, holdout_r7, holdout_r8 and item5. r7 never saw the r8 operations (OP_*, PRICE_EXPENSIVE), which explains its low holdout_r8 score.

On holdout_r7, r8 has one invented price in English ("warm hat-free hoodie" read as expensive) and a lower French filter recall (0.932 → 0.915).

Limitations

  • Synthetic and template-heavy: real shopper queries are more varied. test_in_distribution comes from the same templates as train.
  • Labels are Luma sample-catalog labels; another store needs its own label set and retraining.
  • Prices are written in euros, "bucks", € or with no currency, while the Luma store prices in USD. Targets keep only the number.
  • Typos are intentional (about 5 % of template rows) and are not flagged per row.
  • Known gaps: no generic "bag" / "sac" product in r8's data, and few multi-word "show more" rows.
  • holdout_r2 and holdout_r3 were relabelled after they were first frozen (see CHANGES.md and CONVENTIONS.md).

Files

  • data/<config>/<split>.parquet: the data.
  • labels/: tag sets and the allowed values per field.
  • CONVENTIONS.md: the labelling rules, written round by round before each holdout.
  • CHANGES.md: every change made when converting the original training files, with counts.
  • checksums.json: sha256 of each original training file (as recorded in the shipped models) and of each Parquet file.

License

The dataset (query texts, labels, spans and annotations) is released under the Apache-2.0 license.

Notice: Magento Luma sample data. The label values (attribute option labels such as colours, activities, climates and materials, and the product category words) come from the Magento Open Source Luma sample data (magento/module-*-sample-data), which Magento / Adobe distributes under the OSL-3.0 and AFL-3.0 licenses. Those labels are used here as short factual category values; no product descriptions, images or other sample-data content are included. Magento and Luma are trademarks of Adobe.