CoolFace
Modelpublic

Trendyol/TY-ecomm-asure-relevance

sourceHugging Faceapache-2.0updated 2d agoView on Hugging Face
5likes40downloads
Model Card

TY-ecomm-asure-relevance

<img src="trendyolllmasure.png" width="300" alt="Trendyol-LLM-Asure-Logo" />

A multilingual cross-encoder that scores how relevant a product is to a query, over the four ESCI classes. Distilled from Trendyol/Trendyol-LLM-Asure-12B.

Model Details

Developed byTrendyol - LLM & Core NLP Team
Model typeCross-encoder sequence-pair classifier (4 classes)
Base modelTrendyol/TY-ecomm-embed-multilingual-base-v1.2.0
Parameters311.3M
LanguagesTurkish, Arabic, Romanian, English
Max sequence length512 tokens
Inputsinput_ids, attention_mask (no token_type_ids)
Output4 raw logits, apply softmax yourself
LicenseApache-2.0

Labels

idlabelmeaningexample for query *iphone 15*
0irrelevantno meaningful relationSamsung Galaxy S24 case
1complementaryrelated, serves a different neediPhone 15 screen protector
2substitutea reasonable alternativeSamsung Galaxy S24 blue
3relevantdirectly satisfies the query intentiPhone 15 128 GB blue

Intended Use

Use this model to classify product candidates for a user query by estimating whether each product is irrelevant, complementary, substitute, or relevant.

Limitations

The model can make incorrect relevance judgments and only uses the text fields provided at inference time. It does not see product images and should not be treated as having general world knowledge beyond the query-product text pair.

Input format

The first sequence is the query. The second is the product document: seven fields, one per line, separated by \n, using these exact English field names. They are the product attributes the model saw in training, so keep the names, the order and the separators.

title: {title}
category: {category}
brand: {brand}
gender: {gender}
age_group: {age_group}
marketplace_sellers: {seller1 | seller2 | ...}
attributes: {key1}: {value1}, {key2}: {value2}, ...
rulevalue
missing fieldthe literal string unknown
sellersdeduplicated case-insensitively, first 10, joined with ` \`
attributesdrop any whose value exceeds 100 characters, then keep the first 30
attributes renderingkey: value, joined with , on one line; attributes: unknown if none
text normalizationlowercase, NFC, and i̇ to i

The tokenizer encodes the pair as <s> query </s></s> document </s>.

Sample input and output

Input:

query: "dönen mumluk"

title: truro mumluk naturel (11x14,5x5 cm)
category: ev ve mobilya / ev dekorasyon / şamdan mumluk
brand: bella maison
gender: unknown
age_group: unknown
marketplace_sellers: bella maison
attributes: renk: turuncu, materyal: ahşap, parça sayısı: 1, color detail: şeffaf

Output:

python
{'irrelevant': 0.0368, 'complementary': 0.0129, 'substitute': 0.9253, 'relevant': 0.025}

A rotating candle holder was searched for and a plain wooden one was found, so the product scores as substitute rather than relevant.

Installation

bash
pip install torch "transformers>=4.57,<5"

transformers 5.x is not supported yet.

How to use

python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

model_id = "Trendyol/TY-ecomm-asure-relevance"
tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForSequenceClassification.from_pretrained(model_id, trust_remote_code=True).eval()

query = "dönen mumluk"
document = "\n".join([
    "title: truro mumluk naturel (11x14,5x5 cm)",
    "category: ev ve mobilya / ev dekorasyon / şamdan mumluk",
    "brand: bella maison",
    "gender: unknown",
    "age_group: unknown",
    "marketplace_sellers: bella maison",
    "attributes: renk: turuncu, materyal: ahşap, parça sayısı: 1, color detail: şeffaf",
])

enc = tok(query, document, truncation=True, max_length=512, return_tensors="pt")
with torch.no_grad():
    probs = model(**enc).logits.softmax(-1)[0]
print({model.config.id2label[i]: round(p.item(), 4) for i, p in enumerate(probs)})

trust_remote_code=True is required: both the GTE encoder and the classification head are defined in this repository rather than in transformers.

Scoring many candidates for one query

python
queries = [query] * len(documents)
enc = tok(queries, documents, truncation=True, max_length=512,
          padding=True, return_tensors="pt")
with torch.no_grad():
    scores = model(**enc).logits.softmax(-1)[:, 3]  # P(relevant)

Training data

~1.5M query-product pairs in Turkish, Arabic, Romanian, English languages.

License

Apache-2.0

Citation

bibtex
@misc{trendyol-ty-ecomm-asure-relevance,
  title  = {TY-ecomm-asure-relevance: Trendyol E-commerce Multilingual Query-Product Relevance Cross-Encoder},
  author = {Trendyol - LLM & Core NLP Team},
  year   = {2026},
  url    = {https://huggingface.co/Trendyol/TY-ecomm-asure-relevance}
}

Model Card Authors

Trendyol - LLM & Core NLP Team