Instructions to use dfrokido/bge-large-e8-snap with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use dfrokido/bge-large-e8-snap with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("dfrokido/bge-large-e8-snap") 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
bge-large-e8-snap
bge-large-en-v1.5 fine-tuned with RF-Snap to align embeddings to the E8 lattice.
Part of the LatticeMemory project. GitHub โ
What Makes This Different
Standard embedding models output float32 vectors. This model is trained so its outputs naturally snap to the nearest point in the E8 lattice โ the densest sphere packing in 8 dimensions. The result: a 32x smaller index with better STS quality than the float32 baseline.
Benchmarks
| Metric | Float baseline (bge-large-en-v1.5) | This model |
|---|---|---|
| STSBenchmark (Spearman) | 0.8637 | 0.8714 (+0.0077) |
| STS13 | โ | 0.8826 |
| Index compression | 1x | 32x |
| Retrieval @ 100K docs | 20.8 ms (scan) | O(1) on E8 key hit |
| Recall@10 (MS-MARCO 1K) | 100% | 100% |
Compression basis: 1 address byte per 8-dim block ร 128 blocks = 128 bytes for a 1024-dim embedding, vs 4,096 bytes for float32 = 32x. This applies to E8 key storage; see LatticeMemory for hybrid mode, which also stores a dense fallback index for asymmetric retrieval.
Usage
from sentence_transformers import SentenceTransformer
import torch, math, torch.nn.functional as F
model = SentenceTransformer("dfrokido/bge-large-e8-snap")
embeddings = model.encode(["What is the capital of France?"], convert_to_tensor=True)
embeddings = F.normalize(embeddings.float(), p=2, dim=1)
# Embeddings are now ready for LatticeMemory indexing โ 32x smaller index
Training
Fine-tuned from BAAI/bge-large-en-v1.5 using RF-Snap training:
- Loss: cosine similarity + MNRL + E8 address cross-entropy + teacher anchor
- Data: NLI 50K pairs
- Config: freeze_until=10/24, lr=3e-6, batch=8, grad_accum=4, 1 epoch
- Hardware: GTX 1660 Ti (6GB VRAM)
LatticeMemory
This model powers LatticeMemory
(GitHub, pip install latticememory) โ
a semantic cache, dedup, and hybrid memory library for LLM applications. 32x compressed
E8 keys for instant repeat-query cache hits, dense fallback for novel retrieval.
Design partner inquiries: dfrokido@gmail.com
- Downloads last month
- 1,185
Model tree for dfrokido/bge-large-e8-snap
Base model
BAAI/bge-large-en-v1.5Spaces using dfrokido/bge-large-e8-snap 2
Evaluation results
- spearman_cosine on STSBenchmarkself-reported0.871