all_datasets_v4_MiniLM-L6 - LiteRT
This is a LiteRT (formerly TensorFlow Lite) conversion of flax-sentence-embeddings/all_datasets_v4_MiniLM-L6 for efficient on-device inference.
Model Details
| Property | Value |
|---|---|
| Original Model | flax-sentence-embeddings/all_datasets_v4_MiniLM-L6 |
| Format | LiteRT (.tflite) |
| File Size | 86.0 MB |
| Task | Sentence Embeddings / Semantic Similarity |
| Max Sequence Length | 128 |
| Output Dimension | 384 |
| Pooling Mode | Mean Pooling |
Performance
Benchmarked on AMD CPU (WSL2):
| Metric | Value |
|---|---|
| Inference Latency | 10.0 ms |
| Throughput | 100.0 tokens/sec |
| Cosine Similarity vs Original | 1.0000 โ |
Quick Start
import numpy as np
from ai_edge_litert.interpreter import Interpreter
from transformers import AutoTokenizer
# Load model and tokenizer
interpreter = Interpreter(model_path="flax-sentence-embeddings_all_datasets_v4_MiniLM-L6.tflite")
interpreter.allocate_tensors()
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
tokenizer = AutoTokenizer.from_pretrained("flax-sentence-embeddings/all_datasets_v4_MiniLM-L6")
def get_embedding(text: str) -> np.ndarray:
"""Get sentence embedding for input text."""
encoded = tokenizer(
text,
padding="max_length",
max_length=128,
truncation=True,
return_tensors="np"
)
interpreter.set_tensor(input_details[0]["index"], encoded["input_ids"].astype(np.int64))
interpreter.set_tensor(input_details[1]["index"], encoded["attention_mask"].astype(np.int64))
interpreter.invoke()
return interpreter.get_tensor(output_details[0]["index"])[0]
# Example
embedding = get_embedding("Hello, world!")
print(f"Embedding shape: {embedding.shape}") # (384,)
Files
flax-sentence-embeddings_all_datasets_v4_MiniLM-L6.tflite- The LiteRT model file
Conversion Details
- Conversion Tool: ai-edge-torch
- Conversion Date: 2026-01-12
- Source Framework: PyTorch โ LiteRT
- Validation: Cosine similarity 1.0000 vs original
Intended Use
- Mobile Applications: On-device semantic search, RAG systems
- Edge Devices: IoT, embedded systems, Raspberry Pi
- Offline Processing: Privacy-preserving inference
- Low-latency Applications: Real-time processing
Limitations
- Fixed sequence length (128 tokens)
- CPU inference (GPU delegate requires setup)
- Tokenizer loaded separately from original model
- Float32 precision
License
This model inherits the license from the original:
- License: Apache 2.0 (source)
Citation
@misc{flax-sentence-embeddings,
title={Flax Sentence Embeddings},
author={Flax Community},
year={2021},
url={https://huggingface.co/flax-sentence-embeddings}
}
Acknowledgments
- Original model by flax-sentence-embeddings
- Conversion using ai-edge-torch
Converted by Bombek1
- Downloads last month
- 3