gte-reranker-modernbert-base β€” COREAI

Original ModernBERT cross-encoder reranker. Tokenize the query and candidate document as a text pair. The original mean-pooled classification head is retained; output is a raw relevance logit.

Converted directly from Alibaba-NLP/gte-reranker-modernbert-base at revision f7481e6055501a30fb19d090657df9ec1f79ab2c. No new fine-tuning or replacement checkpoint. F32 baseline, not 4-bit quantization. Attribution: original checkpoint authors; format conversion by masahiroid.

Runtime and shapes

Apple Core AI (*.aimodel), F32. Validated on macOS 27.2 with coreai-core==1.0.0b3 GPU execution; exported with coreai-torch==0.4.3. This is not a Core ML package.

All exported components use fixed shapes and batch size 1:

  • text: {"input_ids": [1, 128], "attention_mask": [1, 128]}

Text is padded/truncated to 128 tokens for Ruri/GTE and 77 for CLAP. The source Ruri/GTE checkpoints support longer contexts, but these exports do not expose those longer lengths. Included helpers handle tokenization and shape conversion. For GTE, the 128-token limit is shared by query and document. Audio retains the original processor's 10-second window and long-clip fusion.

Usage

Install the tested backend and preprocessing dependencies in an appropriate Apple Silicon environment:

pip install coreai-core==1.0.0b3 numpy huggingface_hub transformers==4.57.3
from huggingface_hub import snapshot_download
import sys, numpy as np
path = snapshot_download("masahiroid/gte-reranker-modernbert-base-coreai")
sys.path.insert(0, path)
from inference import ConvertedModel
model = ConvertedModel(path)
logit = model.text("What is the capital of France?", text_pair="Paris is the capital of France.")
print(logit)  # higher means more relevant

The synchronous Core AI helper is intended for standalone scripts. If using an existing async event loop, adapt its predict coroutine instead of nesting asyncio.run.

Validation

Numerically compared with the original PyTorch checkpoint: maximum absolute output difference 1.9073486e-06, minimum cosine similarity 1. Per-case results and input shapes are in validation.json; deterministic input tensors and reference outputs are in *_validation_vectors.npz.

Ruri tests include Japanese retrieval prefixes, Japanese text, English and empty input. GTE tests include relevant/irrelevant query-document pairs and ranking-preference agreement. CLAP tests include six text inputs and three audio signals for each of the fusion and non-fusion paths. No claim of improved task quality, robustness or device speed is made.

Reproduction and license

provenance.json pins the exact source checkpoint. prepare.py, common.py, build.py and sources.json are included for reproduction; arrange source snapshots under sources/<model-name>/. Tested conversion environment: PyTorch 2.14.1, Transformers 4.57.3, NumPy 1.26.4 and coremltools 9.0; MLX 0.32.4; Core AI conversion uses the separate Python 3.14 environment above. Model data is saved without pickle checkpoints. Review included Python before executing it.

Original weights remain Apache-2.0, as declared by the source model card (LICENSE). Runtime/converter additions: MIT (CODE_LICENSE).

Converted formats

Downloads last month
26
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for masahiroid/gte-reranker-modernbert-base-coreai

Finetuned
(27)
this model