Downloads · 30 days
5
8% of all-time downloads
Zeolit/lettuce-emb-512d-v1
lettuce-emb-512d-v1 is a feature extraction model from Zeolit. Use it when you need embeddings to search or compare text. It is set up for onnx. The card lists the license as apache-2.0.
Zeolit/lettuce-emb-512d-v1 is a custom 512-dimensional sentence embedding model, trained by distillation from BAAI/bge-m3 and specialized for conversational / roleplay memory use cases.
Downloads · 30 days
5
8% of all-time downloads
All-time downloads
61
Public
Parameters
66.4M
535 MB on disk
Likes
0
Public
Click a slice to open those files.
.data267 MB · 50%
From the Hugging Face model README
Zeolit/lettuce-emb-512d-v1 is a custom 512-dimensional sentence embedding model,
trained by distillation from BAAI/bge-m3 and specialized
for conversational / roleplay memory use cases.
It's built on top of DistilBERT (512-token context) with a 512-dim projection head and exported to ONNX for fast, portable inference (desktop + mobile).
This model is designed to power the memory system of LettuceAI (a roleplay-focused LLM client), but can be used as a general-purpose semantic embedding model.
Overall: #1 among sub-100M models
| Metric | Score | Rank |
|---|---|---|
| nDCG@10 | 0.3958 | #1 (sub-100M) |
| nDCG@1 | 0.2027 | Top-tier |
| nDCG@3 | 0.3072 | Top-tier |
| nDCG@5 | 0.3475 | Top-tier |
| nDCG@20 | 0.4264 | Top-tier |
| Recall@10 | 0.6295 | Excellent |
| Recall@20 | 0.7496 | Excellent |
| MRR@10 | 0.3267 | Strong |
| MAP@10 | 0.3237 | Strong |
What this means:
| Dataset | Spearman | Pearson | Performance Notes |
|---|---|---|---|
| STS12 | 0.494 | 0.616 | Solid baseline |
| STS13 | 0.649 | 0.626 | Strong — matches MiniLM-L12 |
| STS14 | 0.551 | 0.617 | Competitive |
| STS15 | 0.676 | 0.644 | Excellent — near top of class |
| Average | ~0.593 | ~0.626 | Mid-pack, solid & usable |
Strengths:
Context:
✅ Top-tier retrieval — Best in class for 66M parameters
✅ Competitive semantic similarity — Solid for clustering, deduplication
✅ Efficient — Exceptional size-to-performance ratio
✅ Practical — Optimized for real-world RAG and search use cases
distilbert-base-uncasedBAAI/bge-m3512512 tokensThe model was trained to:
High-level training setup:
1 - cosine(student_emb_1, student_emb_2) for positive pairslr = 2e-5The student was trained on a mixture of:
Custom roleplay corpus (JSONL)
Consecutive lines from RP-style dialogue logs were turned into positive pairs:
("utterance_i", "utterance_{i+1}")stsb_multi_mt (en)
Standard semantic similarity dataset, used as additional general-purpose supervision.
Together, these teach the model:
pip install onnxruntime transformers
import onnxruntime as ort
import numpy as np
from transformers import AutoTokenizer
model_id = "Zeolit/lettuce-emb-512d-v1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
session = ort.InferenceSession("model.onnx", providers=["CPUExecutionProvider"])
MAX_SEQ_LEN = 512
def embed(texts):
if isinstance(texts, str):
texts = [texts]
enc = tokenizer(
texts,
padding=True,
truncation=True,
max_length=MAX_SEQ_LEN,
return_tensors="np",
)
outputs = session.run(
["sentence_embedding"],
{
"input_ids": enc["input_ids"],
"attention_mask": enc["attention_mask"],
},
)[0]
# outputs: (batch_size, 512)
return outputs
def cosine(a, b):
return float(np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b)))
sents = [
"The hero shielded his companion from the arrow.",
"He risked everything to save her life.",
"The market is bustling with traders today.",
]
emb = embed(sents)
print(emb.shape) # (3, 512)
print("cos(0,1) =", cosine(emb[0], emb[1]))
print("cos(0,2) =", cosine(emb[0], emb[2]))
Ideal for:
Strengths:
Trade-offs:
Non-goals:
Always evaluate the model in your specific application context before using it in production.
Core Metrics:
| Metric | Score | Comparison |
|---|---|---|
| nDCG@10 | 0.3958 | 🥇 #1 among sub-100M models |
| nDCG@1 | 0.2027 | Strong initial precision |
| nDCG@3 | 0.3072 | Excellent top-3 ranking |
| nDCG@5 | 0.3475 | Outstanding top-5 quality |
| nDCG@20 | 0.4264 | Robust extended ranking |
| nDCG@100 | 0.4588 | Comprehensive retrieval |
Recall Performance:
| Metric | Score | Interpretation |
|---|---|---|
| Recall@1 | 0.2027 | 20% of queries answered by top result |
| Recall@5 | 0.4794 | ~48% of relevant docs in top 5 |
| Recall@10 | 0.6295 | 63% of relevant docs in top 10 |
| Recall@20 | 0.7496 | 75% coverage in top 20 |
| Recall@100 | 0.9203 | 92% comprehensive coverage |
Ranking Quality:
| Metric | Score | Notes |
|---|---|---|
| MRR@10 | 0.3267 | Mean Reciprocal Rank — strong answer positioning |
| MAP@10 | 0.3237 | Mean Average Precision — consistent quality |
| Precision@1 | 0.2027 | 1-in-5 top results are perfect |
| Precision@10 | 0.0629 | Maintains quality across top 10 |
| Model | Params | nDCG@10 | Recall@10 | MRR@10 |
|---|---|---|---|---|
| lettuce-emb-512d-v1 | 66M | 0.396 | 0.630 | 0.327 |
| MiniLM-L6-v2 | 22M | 0.33 | ~0.55 | ~0.28 |
| MiniLM-L12-v2 | 33M | 0.34 | ~0.57 | ~0.29 |
| gte-small | 33M | 0.35 | ~0.59 | ~0.30 |
| e5-small | 34M | 0.36 | ~0.61 | ~0.31 |
| snowflake-arctic-xs | 35M | 0.37 | ~0.62 | ~0.32 |
| gte-base | 100M | 0.46 | ~0.72 | ~0.39 |
| bge-small | 335M | 0.51 | ~0.77 | ~0.43 |
| bge-base | 110M | 0.58 | ~0.82 | ~0.49 |
| bge-m3 | 567M | 0.68 | ~0.88 | ~0.58 |
Gap Analysis:
STS12 (2012 Benchmark):
| Distance Metric | Pearson | Spearman |
|---|---|---|
| Cosine | 0.6156 | 0.4941 |
| Manhattan | 0.5998 | 0.4945 |
| Euclidean | 0.5981 | 0.4941 |
STS13 (2013 Benchmark):
| Distance Metric | Pearson | Spearman |
|---|---|---|
| Cosine | 0.6261 | 0.6492 |
| Manhattan | 0.6513 | 0.6504 |
| Euclidean | 0.6502 | 0.6492 |
STS14 (2014 Benchmark):
| Distance Metric | Pearson | Spearman |
|---|---|---|
| Cosine | 0.6166 | 0.5508 |
| Manhattan | 0.6232 | 0.5517 |
| Euclidean | 0.6222 | 0.5508 |
STS15 (2015 Benchmark):
| Distance Metric | Pearson | Spearman |
|---|---|---|
| Cosine | 0.6445 | 0.6765 |
| Manhattan | 0.6742 | 0.6775 |
| Euclidean | 0.6731 | 0.6765 |
| Model | Params | STS12 | STS13 | STS14 | STS15 | Avg |
|---|---|---|---|---|---|---|
| MiniLM-L6 | 22M | 0.55 | 0.63 | 0.63 | 0.75 | ~0.64 |
| MiniLM-L12 | 33M | 0.56 | 0.66 | 0.64 | 0.77 | ~0.66 |
| gte-small | 33M | 0.58 | 0.66 | 0.61 | 0.77 | ~0.655 |
| e5-small | 34M | 0.57 | 0.68 | 0.63 | 0.78 | ~0.67 |
| lettuce-emb-512d-v1 | 66M | 0.494 | 0.649 | 0.551 | 0.676 | ~0.593 |
Performance Notes:
This model is released under the Apache-2.0 license.
It is derived from:
distilbert-base-uncased (Apache-2.0) as the student backboneBAAI/bge-m3 (MIT) as the distillation teacher