French query intent (Chat vs Search) + embedding in one pass — q8 ONNX

rolf-mozilla/french-embedding-e5-distilled with a linear Chat / Search intent head on its 256-d embedding, exported as one graph with three outputs, so a single forward pass gives both the intent and the embedding — no separate classifier model. 28.3 MB int8 ONNX.

output shape meaning
logits [batch, 2] intent logits, 0 = Chat, 1 = Search
sentence_embedding [batch, 256] mean-pooled, L2-normalized embedding (same as the embedding repo, cos ≥ 0.997)
last_hidden_state [batch, seq, 256] per-token vectors (mean-pool these for the embedding yourself)

Results (French test split of Mozilla/query-intent-detection-dataset-french, q8)

model extra cost on top of the embedding model test acc macro-F1 test acc (queries unseen in train)
this model 514 params (linear head) 0.748 0.738 0.727
Mozilla/query-intent-detection-en-fr separate 14 MB model + forward pass 0.713 0.710 0.696
multilingual-e5-small, fully fine-tuned separate 118 MB model 0.713 0.697 0.700
all-MiniLM-L6-v2, fully fine-tuned separate 23 MB model 0.706 0.689 0.691

The test split (1,378 queries) is ±2.3 accuracy points at 95% confidence. Train and validation are synthetic; validation accuracy (0.96 here) does not predict test accuracy — full fine-tuning, LoRA, MLP heads and joint embedding+intent training all scored higher on validation but lower on test than this frozen-embedding linear head.

Usage (Python, onnxruntime)

import numpy as np, onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer

repo = "rolf-mozilla/french-intent-embedding-e5-distilled"
tok = AutoTokenizer.from_pretrained(repo)
sess = ort.InferenceSession(hf_hub_download(repo, "onnx/model_quantized.onnx"))

e = tok(["météo demain à Lyon", "écris un poème sur l'automne"], padding=True,
        truncation=True, max_length=64, return_tensors="np")
logits, emb = sess.run(["logits", "sentence_embedding"],
                       {"input_ids": e["input_ids"], "attention_mask": e["attention_mask"]})
labels = np.array(["Chat", "Search"])[logits.argmax(-1)]

Training

  • Embedding model frozen (see its card for how it was distilled and the data/licensing notes, including the MS MARCO lineage caveat of its multilingual-e5-small base).
  • Intent head: logistic regression on the normalized q8 embedding, trained on the 233k-query train split of Mozilla/query-intent-detection-dataset-french; feature standardization is folded into the head's weights.
  • French only; queries truncated to 64 tokens for intent.
Downloads last month
30
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for rolf-mozilla/french-intent-embedding-e5-distilled

Dataset used to train rolf-mozilla/french-intent-embedding-e5-distilled