ruri-v3-70m — COREML

Japanese retrieval/semantic embeddings from the original Ruri-v3-70m checkpoint. Mask-aware mean pooling and L2 normalization are included. Retrieval inputs use the original prefixes 検索クエリ: and 検索文書: .

Converted directly from cl-nagoya/ruri-v3-70m at revision 07a8b0aba47d29d2ca21f89b915c1efe2c23d1cc. No new fine-tuning or replacement checkpoint. F32 baseline, not 4-bit quantization. Attribution: original checkpoint authors; format conversion by masahiroid.

Runtime and shapes

Core ML ML Program (*.mlpackage), F32 computation. Export target: macOS 14/iOS 17; inference was validated on macOS 27.2. iPhone performance has not been measured.

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 coremltools==9.0 numpy huggingface_hub transformers==4.57.3
from huggingface_hub import snapshot_download
import sys, numpy as np
path = snapshot_download("masahiroid/ruri-v3-70m-coreml")
sys.path.insert(0, path)
from inference import ConvertedModel
model = ConvertedModel(path)
embedding = model.text("検索クエリ: 日本の首都はどこですか?")
print(embedding.shape)  # (1, 384)

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 2.1792948e-07, minimum cosine similarity 0.999999999999. 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
28
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for masahiroid/ruri-v3-70m-coreml

Quantized
(10)
this model