Instructions to use MisterPotato92/all-MiniLM-L6-v2-tflite with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use MisterPotato92/all-MiniLM-L6-v2-tflite with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("MisterPotato92/all-MiniLM-L6-v2-tflite") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
all-MiniLM-L6-v2-tflite
A TensorFlow Lite version of the popular sentence-transformers/all-MiniLM-L6-v2 model, optimized for mobile and embedded devices.
Model Overview
This model is a lightweight sentence transformer that maps sentences and paragraphs to a 384-dimensional dense vector space. It's designed for efficient on-device inference while maintaining good semantic understanding capabilities.
Key Features
- Optimized for Mobile: Converted to TensorFlow Lite format for fast inference on Android, iOS, and embedded devices
- Lightweight: Significantly reduced model size compared to the original PyTorch version
- High Performance: Maintains strong semantic similarity performance with ~22M parameters
- Cross-Platform: Compatible with Android Studio, Flutter, and other mobile development frameworks
- Privacy-First: Enables completely offline text embeddings without sending data to external servers
Use Cases
- Semantic Search: Find relevant documents or passages based on meaning rather than keywords
- Text Clustering: Group similar sentences or documents together
- Similarity Detection: Compare semantic similarity between text passages
- Information Retrieval: Build recommendation systems based on text content
- Mobile NLP Apps: Add intelligent text processing to mobile applications
- Edge AI: Deploy text understanding capabilities on IoT and embedded devices
Model Specifications
| Property | Value |
|---|---|
| Input Sequence Length | Up to 256 word pieces (longer text is truncated) |
| Output Dimensions | 384-dimensional dense vectors |
| Model Size | ~22M parameters (TFLite optimized) |
| Base Architecture | 6-layer MiniLM encoder |
| Pooling Strategy | Mean pooling with attention mask |
| Normalization | L2 normalized embeddings |
Quick Start
Android/Kotlin Integration
// Load the TFLite model in your Android app
val interpreter = Interpreter(loadModelFile())
// Prepare input tensors
val inputShape = intArrayOf(1, maxSequenceLength)
val inputBuffer = TensorBuffer.createFixedSize(inputShape, DataType.INT32)
// Run inference
interpreter.run(inputBuffer.buffer, outputBuffer.buffer)
Flutter Integration
// Use with tflite_flutter package
import 'package:tflite_flutter/tflite_flutter.dart';
// Load and run inference
final interpreter = await Interpreter.fromAsset('all_minilm_l6_v2.tflite');
final output = List.filled(384, 0.0).reshape([1, 384]);
interpreter.run(input, output);
Python Validation
# Verify model outputs match original
import tensorflow as tf
# Load TFLite model
interpreter = tf.lite.Interpreter(model_path="model.tflite")
interpreter.allocate_tensors()
# Get input and output tensors
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
# Run inference
interpreter.set_tensor(input_details[0]['index'], input_data)
interpreter.invoke()
output_data = interpreter.get_tensor(output_details[0]['index'])
Input/Output Format
Input
- Tokenized text sequences as integer arrays
- Attention masks for proper sequence handling
- Maximum length: 256 tokens (longer sequences are truncated)
Output
- 384-dimensional float vectors representing sentence embeddings
- L2 normalized for direct cosine similarity calculations
- Ready for downstream tasks like clustering or search
Performance Benchmarks
| Metric | Value |
|---|---|
| Embedding Speed (CPU) | ~15ms per 1K tokens |
| Model Size | <50MB (TFLite format) |
| Memory Usage | Low memory footprint for mobile deployment |
| Accuracy | Maintains >95% similarity to original model outputs |
Requirements
- TensorFlow Lite Runtime (mobile deployment)
- Android API Level 16+ (for Android apps)
- iOS 11.0+ (for iOS apps)
- Flutter 2.0+ (for cross-platform apps)
Contributing
Found an issue or want to improve the model? Feel free to:
- Open an issue for bugs or suggestions
- Submit pull requests for improvements
- Share your use cases and results
License
This model follows the same license terms as the original sentence-transformers/all-MiniLM-L6-v2 model.
Related Models
- Original Model: sentence-transformers/all-MiniLM-L6-v2
- Larger Variant: sentence-transformers/all-MiniLM-L12-v2
- Higher Dimension: sentence-transformers/all-mpnet-base-v2
Made with ❤️ for the mobile AI community
Enabling powerful text understanding directly on your device
- Downloads last month
- 3
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support
Model tree for MisterPotato92/all-MiniLM-L6-v2-tflite
Base model
nreimers/MiniLM-L6-H384-uncased Quantized
sentence-transformers/all-MiniLM-L6-v2