This is Google's EmbeddingGemma 300M model converted to the LiteRT-LM .litertlm format for use with Google's LiteRT-LM runtime. This format is optimized for on-device inference on mobile and edge devices.
This model was created by converting the TFLite model from litert-community/embeddinggemma-300m to the LiteRT-LM .litertlm bundle format using Google's official tooling:
Downloaded the source TFLite model (embeddinggemma-300M_seq512_mixed-precision.tflite)
Created a TOML configuration specifying the model structure:
Benchmarks performed on a ThinkPad X1 Carbon 9th Gen (Intel Core i7-1165G7 @ 2.80GHz, CPU only, no GPU acceleration).
Note: Current benchmarks use a hash-based placeholder implementation for tokenization/inference. Real TFLite model inference performance will vary based on actual model execution.
API Overhead Benchmarks
Metric
Value
Initialization
<1ms
Latency (short text)
0.002ms
Latency (medium text)
0.003ms
Latency (long text)
0.003ms
Memory per embedding
0.32 KB
Batch Processing
Batch Size
Time/Batch
Time/Item
1
0.004ms
0.004ms
5
0.015ms
0.003ms
10
0.031ms
0.003ms
20
0.074ms
0.004ms
Expected Real-World Performance
Based on similar embedding models running on comparable hardware:
Scenario
Expected Latency
Single embedding (CPU)
10-50ms
Batch of 10 (CPU)
50-200ms
With XNNPACK optimization
5-20ms
C API Usage
For direct C/C++ integration:
c
1#include"c/embedder.h"23// Create settings4LiteRtEmbedderSettings* settings =litert_embedder_settings_create(5"embeddinggemma-300m.litertlm",// model path6256,// embedding dimension7512// max sequence length8);9litert_embedder_settings_set_num_threads(settings,4);1011// Create embedder12LiteRtEmbedder* embedder =litert_embedder_create(settings);1314// Generate embedding15LiteRtEmbedding* embedding =litert_embedder_embed(embedder,"Hello world");16constfloat* data =litert_embedding_get_data(embedding);17int dim =litert_embedding_get_dim(embedding);1819// Use embedding for similarity search, etc.20// ...2122// Cleanup23litert_embedding_delete(embedding);24litert_embedder_delete(embedder);25litert_embedder_settings_delete(settings);
Use Cases
Semantic search on mobile/edge devices
Document similarity without cloud dependencies
RAG (Retrieval Augmented Generation) with local embeddings
MCP tool matching for AI agents
Offline text classification
Limitations
Tokenization: Currently uses a simplified character-based tokenizer. For best results, integrate with SentencePiece using the Gemma tokenizer vocabulary.
Model Inference: The current wrapper uses placeholder inference. Full TFLite inference integration requires linking against the LiteRT C API.
Platform Support: Currently tested on Linux x86_64. macOS and Windows support requires platform-specific builds.
Repository Structure
models/
├── embeddinggemma-300m.litertlm # This model
├── embeddinggemma-300m.toml # Conversion config
└── embeddinggemma-300M_seq512_mixed-precision.tflite # Source TFLite
native-bridge/
├── src/litert_lm_binding.cc # N-API bindings
├── binding.gyp # Build configuration
└── lib/index.d.ts # TypeScript definitions
deps/LiteRT-LM/c/
├── embedder.h # C API header
└── embedder.cc # C implementation
License
This model conversion is provided under the Apache 2.0 license. The original EmbeddingGemma model is subject to Google's model license - please refer to the original model card for details.
Acknowledgments
EmbeddingGemma by Google Research
LiteRT-LM by Google AI Edge team
TFLite Community for the pre-converted TFLite model
Citation
If you use this model, please cite the original EmbeddingGemma paper:
bibtex
1@article{embeddinggemma2024,
2 title={EmbeddingGemma: Efficient Text Embeddings from Gemma},
3 author={Google Research},
4 year={2024}
5}