cl-nagoya/ruri-v3-reranker-310m-preview

🤗 Hugging Face sourcetext-rankingapache-2.0315M params1.3 GBsafetensors✓ 2 checksumsupdated today
Submit in one command

Run it next to your model folder. It makes the torrent, checks your files against Hugging Face, and submits it. You just start seeding and paste your key from your account. It only reads your files and never changes them. Read the script first if you like.

curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo cl-nagoya/ruri-v3-reranker-310m-preview ./model-folder
Needs a seeder →

Ruri-Reranker: Japanese General Reranker

⚠️Notes: This model is a preview version.
For the better, sophisticated version, please use cl-nagoya/ruri-v3-reranker-310m!

How to Use

You can use our models directly with the transformers library v4.48.0 or higher:

pip install -U "transformers>=4.48.0" sentence-transformers

Additionally, if your GPUs support Flash Attention 2, we recommend using our models with Flash Attention 2.

pip install flash-attn --no-build-isolation

Example Usage (Sentence Transformers)

from sentence_transformers import CrossEncoder

# Download from the 🤗 Hub
model = CrossEncoder("cl-nagoya/ruri-v3-reranker-310m-preview")

inputs = [
    [
        "瑠璃色はどんな色?",
        "瑠璃色(るりいろ)は、紫みを帯びた濃い青。名は、半貴石の瑠璃(ラピスラズリ、英: lapis lazuli)による。JIS慣用色名では「こい紫みの青」(略号 dp-pB)と定義している[1][2]。",
    ],
    [
        "瑠璃色 なに",
        "瑠璃色(るりいろ)は、紫みを帯びた濃い青。名は、半貴石の瑠璃(ラピスラズリ、英: lapis lazuli)による。JIS慣用色名では「こい紫みの青」(略号 dp-pB)と定義している[1][2]。",
    ],
    [
        "瑠璃色はどんな色?",
        "ワシ、タカ、ハゲワシ、ハヤブサ、コンドル、フクロウが代表的である。これらの猛禽類はリンネ前後の時代(17~18世紀)には鷲類・鷹類・隼類及び梟類に分類された。ちなみにリンネは狩りをする鳥を単一の目(もく)にまとめ、vultur(コンドル、ハゲワシ)、falco(ワシ、タカ、ハヤブサなど)、strix(フクロウ)、lanius(モズ)の4属を含めている。",
    ],
    [
        "ワシやタカのように、鋭いくちばしと爪を持った大型の鳥類を総称して「何類」というでしょう?",
        "ワシ、タカ、ハゲワシ、ハヤブサ、コンドル、フクロウが代表的である。これらの猛禽類はリンネ前後の時代(17~18世紀)には鷲類・鷹類・隼類及び梟類に分類された。ちなみにリンネは狩りをする鳥を単一の目(もく)にまとめ、vultur(コンドル、ハゲワシ)、falco(ワシ、タカ、ハヤブサなど)、strix(フクロウ)、lanius(モズ)の4属を含めている。",
    ],
    [
        "ワシやタカのように、鋭いくちばしと爪を持った大型の鳥類を総称して「何類」というでしょう?",
        "瑠璃色(るりいろ)は、紫みを帯びた濃い青。名は、半貴石の瑠璃(ラピスラズリ、英: lapis lazuli)による。JIS慣用色名では「こい紫みの青」(略号 dp-pB)と定義している[1][2]。",
    ],
]

scores = model.predict(inputs)
print(scores)
# [
#   0.99979633,
#   0.99517965,
#   0.000025507017,
#   0.99851805,
#   0.000023804054,
# ]


result = model.rank(
    query="瑠璃色はどんな色?",
    documents=[
        "ワシ、タカ、ハゲワシ、ハヤブサ、コンドル、フクロウが代表的である。これらの猛禽類はリンネ前後の時代(17~18世紀)には鷲類・鷹類・隼類及び梟類に分類された。ちなみにリンネは狩りをする鳥を単一の目(もく)にまとめ、vultur(コンドル、ハゲワシ)、falco(ワシ、タカ、ハヤブサなど)、strix(フクロウ)、lanius(モズ)の4属を含めている。",
        "瑠璃、または琉璃(るり)は、仏教の七宝の一つ。サンスクリットの vaiḍūrya またはそのプラークリット形の音訳である。金緑石のこととも、ラピスラズリであるともいう[1]。",
        "瑠璃色(るりいろ)は、紫みを帯びた濃い青。名は、半貴石の瑠璃(ラピスラズリ、英: lapis lazuli)による。JIS慣用色名では「こい紫みの青」(略号 dp-pB)と定義している[1][2]。",
    ],
)
print(result)
# [
#    {'corpus_id': 2, 'score': 0.99979836},
#    {'corpus_id': 1, 'score': 0.22831681},
#    {'corpus_id': 0, 'score': 0.000025469439},
# ]

Benchmarks

Model #Param.(w/o Emb.) JQaRA
nDCG@10
JaCWIR
MAP@10
MIRACL
Recall@30
Ruri-v3-reranker-310m 315M (236M) 86.9 95.4 97.3
Ruri-v3-reranker-310m-preview 315M (236M) 78.9 94.8 97.2
hotchpotch/japanese-reranker-cross-encoder-xsmall-v1 107M (11M) 61.4 93.8 90.6
hotchpotch/japanese-reranker-cross-encoder-small-v1 118M (21M) 62.5 93.9 92.2
hotchpotch/japanese-reranker-cross-encoder-base-v1 111M (86M) 67.1 93.4 93.3
hotchpotch/japanese-reranker-cross-encoder-large-v1 337M (303M) 71.0 93.6 91.5
hotchpotch/japanese-bge-reranker-v2-m3-v1 568M (303M) 69.2 93.7 94.7
BAAI/bge-reranker-v2-m3 568M (303M) 67.3 93.4 94.9
Ruri-Reranker-Small 68M (43M) 64.5 92.6 92.3
Ruri-Reranker-Base 111M (86M) 74.3 93.5 95.6
Ruri-Reranker-Large 337M (303M) 77.1 94.1 96.1

Model Details

Model Description

Citation

@misc{
  Ruri,
  title={{Ruri: Japanese General Text Embeddings}}, 
  author={Hayato Tsukagoshi and Ryohei Sasano},
  year={2024},
  eprint={2409.07737},
  archivePrefix={arXiv},
  primaryClass={cs.CL},
  url={https://arxiv.org/abs/2409.07737}, 
}

License

This model is published under the Apache License, Version 2.0.