sentence-similarity · feature-extraction · text · WASM q8 · ~43.78 MB · Apache-2.0

Ruri v3 30M — Japanese ModernBERT Embeddings

Nagoya University's cl-nagoya/ruri-v3-30m (37M parameters, 256-d, 8,192-token RoPE context, 102,400 SentencePiece vocabulary) running completely off-thread in your browser on CPU WASM via onnx-community/ruri-v3-30m-ONNX.

At a glance

Upstream model
cl-nagoya/ruri-v3-30m
ONNX graph loaded
onnx-community/ruri-v3-30m-ONNX
Task & pooling
sentence-similarity / feature-extraction · mean pool + L2 norm
Architecture
ModernBERT-Ja · 10 layers · 4 heads · 256-d · 37M params (10M non-emb)
Context & tokenizer
8,192 tokens (local 128 + global RoPE) · 102,400 SentencePiece vocab
Runtime & dtype
Shared Transformers.js 3.7.5 · CPU WASM · q8
Download size
~43.78 MB (37.05 MB ONNX + 6.73 MB tokenizer/config)
License
Apache-2.0 (apache-2.0)

1 · On-device Model & Cache

2 · Live Japanese Semantic Similarity & 1+3 Prefix Switcher

Ruri v3 uses a 1+3 prefix scheme: "" (bare STS), "トピック: " (topic / classification), "検索クエリ: " (retrieval query), and "検索文書: " (retrieval passage). Switch prefixes below or load the official card example to measure live cosine separation.

Curated Japanese & Bilingual Presets
Drop a .txt, .md, .csv, or .json corpus, paste with Ctrl/Cmd+V, or upload:

Top-1 cosine—
Relevant margin—
Total tokens—
Latency—
NaN count—

    3 · See Inside — Cosine Heatmap & 256-d Embedding Inspector

    Pairwise cosine matrix across the query (Q) and every document (D1…Dn), plus the 256-dimensional unit-normalised query vector. Pre-norm shows the raw mean-pooled magnitude before L2 division.

    Pairwise Cosine Heatmap (Q + Documents)

    Numeric pairwise cosine similarity matrix
    Run inference above to populate the similarity matrix.

    256-d Query Vector & Norm Diagnostics

    Pre-L2 norm—
    Post-L2 norm—
    Min / Max—
    Backend / dtype—

    4 · Why Ruri v3 30M Matters

    Explore the Use-Case Ladder

    5 · How the API Works & Source Inspection

    Because onnx-community/ruri-v3-30m-ONNX ships the ONNX graph and config.json without tokenizer.json, the worker pairs AutoTokenizer from cl-nagoya/ruri-v3-30m with AutoModel from onnx-community/ruri-v3-30m-ONNX, then mean-pools last_hidden_state and L2-normalises.

    import { AutoTokenizer, AutoModel } from "@huggingface/transformers";
    
    const tokenizer = await AutoTokenizer.from_pretrained("cl-nagoya/ruri-v3-30m");
    const model = await AutoModel.from_pretrained("onnx-community/ruri-v3-30m-ONNX", {
      device: "wasm",
      dtype: "q8",
    });
    const inputs = tokenizer("検索クエリ: 瑠璃色はどんな色?", { padding: false, truncation: true, max_length: 2048 });
    const out = await model(inputs); // out.last_hidden_state: [1, seq, 256]
    Show the code — Off-thread ModernBERT mean-pool embedding worker
    Show the code — Masked mean pooling & L2 normalisation