crossencoder-camembert-L4-mmarcoFR (ONNX)

ONNX export of antoinelouis/crossencoder-camembert-L4-mmarcoFR — a lightweight 4-layer French cross-encoder (distilled from CamemBERT) trained on mMARCO-fr for passage reranking.

All credit for the model goes to the original author. This repository only adds ONNX weights so the model can run with Transformers.js / ONNX Runtime in JavaScript.

This is the 4-layer counterpart of sneko/crossencoder-camembert-base-mmarcoFR-onnx. It trades a bit of ranking quality (mMARCO-fr MRR@10 ≈ 29.2 vs ≈ 33.4 for the base model) for roughly 3× faster CPU inference, which matters a lot when reranking on small, GPU-less instances.

ℹ️ Like the base export, this one includes the sequence-classification head, so it outputs a relevance score (logits of shape [batch, 1]) and can actually be used for reranking — not the raw last_hidden_state.

Files

File Description
onnx/model.onnx full precision (fp32), ~206 MB
onnx/model_quantized.onnx int8 dynamic quantization (~52 MB) — loaded by default by Transformers.js

Usage (Transformers.js)

import { AutoModelForSequenceClassification, AutoTokenizer } from '@xenova/transformers';

const model_id = 'sneko/crossencoder-camembert-L4-mmarcoFR-onnx';
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
const model = await AutoModelForSequenceClassification.from_pretrained(model_id); // uses model_quantized.onnx

const query = 'projets dans la police';
const passages = ['Police nationale : métiers, recrutement et concours', 'Plateforme de photographie'];

const inputs = tokenizer(new Array(passages.length).fill(query), { text_pair: passages, padding: true, truncation: true });
const { logits } = await model(inputs);
const scores = logits
  .sigmoid()
  .tolist()
  .map(([s]) => s); // higher = more relevant

How it was produced

optimum-cli export onnx \
  --model antoinelouis/crossencoder-camembert-L4-mmarcoFR \
  --task text-classification --opset 14 ./out/
# then int8 dynamic quantization (onnxruntime, QUInt8) -> onnx/model_quantized.onnx

License

MIT, following the original model.

Downloads last month
14
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for sneko/crossencoder-camembert-L4-mmarcoFR-onnx