Instructions to use Trendyol/TY-ecomm-asure-relevance with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Trendyol/TY-ecomm-asure-relevance with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Trendyol/TY-ecomm-asure-relevance", trust_remote_code=True)# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("Trendyol/TY-ecomm-asure-relevance", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
TY-ecomm-asure-relevance
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 by | Trendyol - LLM & Core NLP Team |
| Model type | Cross-encoder sequence-pair classifier (4 classes) |
| Base model | Trendyol/TY-ecomm-embed-multilingual-base-v1.2.0 |
| Parameters | 311.3M |
| Languages | Turkish, Arabic, Romanian, English |
| Max sequence length | 512 tokens |
| Inputs | input_ids, attention_mask (no token_type_ids) |
| Output | 4 raw logits, apply softmax yourself |
| License | Apache-2.0 |
Labels
| id | label | meaning | example for query iphone 15 |
|---|---|---|---|
| 0 | irrelevant |
no meaningful relation | Samsung Galaxy S24 case |
| 1 | complementary |
related, serves a different need | iPhone 15 screen protector |
| 2 | substitute |
a reasonable alternative | Samsung Galaxy S24 blue |
| 3 | relevant |
directly satisfies the query intent | iPhone 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}, ...
| rule | value |
|---|---|
| missing field | the literal string unknown |
| sellers | deduplicated case-insensitively, first 10, joined with | |
| attributes | drop any whose value exceeds 100 characters, then keep the first 30 |
| attributes rendering | key: value, joined with , on one line; attributes: unknown if none |
| text normalization | lowercase, 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:
{'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
pip install torch "transformers>=4.57,<5"
transformers 5.x is not supported yet.
How to use
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
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
@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
- Downloads last month
- 40
Model tree for Trendyol/TY-ecomm-asure-relevance
Base model
Alibaba-NLP/gte-multilingual-base