ruri-v3-310m-tflite
Model Summary
Unofficial LiteRT (.tflite) conversion of cl-nagoya/ruri-v3-310m (a general-purpose Japanese text-embedding model) for Android and other
LiteRT runtimes. All credit for the original model goes to its authors.
Files:
ruri-v3-310m_seq128.tflite,ruri-v3-310m_seq256.tflite,ruri-v3-310m_seq512.tflite(fixed sequence length, fp32, converted withlitert-torch).Inputs:
input_idsandattention_mask, bothint32[1, seq](pad to the fixed length with the tokenizer's pad id; the attention mask is respected in the graph).Output: L2-normalized embedding
[1, dim](mean pooling is inside the graph; use the prefixes from the base model card, e.g.検索クエリ:/検索文書:).Verified on the LiteRT interpreter against PyTorch (see
VERIFICATIONbelow). Tokenizer files are copied from the base model; on-device tokenization: use the KotlinUnigramTokenizer(exact Hugging Face ids on 450/450 fixtures) in japanese-rag-kotlin, which also providesLiteRtEmbedder/LiteRtRerankerfor these files.Verified end to end on the Android emulator (API 36.1, arm64) with the Kotlin library (retrieval and reranking correct for the sample queries). Not included yet: quantized variants (fp16 / int8), the MediaPipe
.taskbundle, real-device latency numbers.Live demo: Ruri Atlas — explore Japanese & English sentence embeddings as a 3-D map in your browser (WebGPU), switch embedding models, toggle the reranker, and see where a prompt-injection lands. Nothing is sent to a server.
Usage (Python, LiteRT interpreter)
import numpy as np
from ai_edge_litert.interpreter import Interpreter
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("cl-nagoya/ruri-v3-310m")
text = "検索文書: 瑠璃色(るりいろ)は、紫みを帯びた濃い青のことである。"
enc = tok(text, padding="max_length", truncation=True, max_length=128, return_tensors="np")
it = Interpreter(model_path="ruri-v3-310m_seq128.tflite"); it.allocate_tensors()
i = it.get_input_details()
it.set_tensor(i[0]["index"], enc["input_ids"].astype(np.int32))
it.set_tensor(i[1]["index"], enc["attention_mask"].astype(np.int32))
it.invoke()
print(it.get_tensor(it.get_output_details()[0]["index"]))
Kotlin / Android (untested sketch): load the file with the LiteRT Interpreter, feed two IntArrays of the fixed length, read a FloatArray.
Security: see SECURITY.md (file audit by model-audit-lite). Related: japanese-llm-security hub.
License: apache-2.0 (same as the base model).
Security
Audited against its upstream with model-audit-lite: weight format, bundled code, and a machine-readable lineage (ML-BOM). Details, checksums and how to reproduce: SECURITY.md.