Feature Extraction
sentence-transformers
Safetensors
English
bert
sentence-similarity
e8-lattice
rf-snap
latticememory
Eval Results (legacy)
text-embeddings-inference
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
Fix compression ratio (10.7x -> 32x), add GitHub link
Browse files
README.md
CHANGED
|
@@ -27,12 +27,13 @@ model-index:
|
|
| 27 |
**bge-large-en-v1.5 fine-tuned with RF-Snap to align embeddings to the E8 lattice.**
|
| 28 |
|
| 29 |
Part of the [LatticeMemory](https://huggingface.co/spaces/dfrokido/LatticeMemory) project.
|
|
|
|
| 30 |
|
| 31 |
## What Makes This Different
|
| 32 |
|
| 33 |
Standard embedding models output float32 vectors. This model is trained so its outputs
|
| 34 |
naturally snap to the nearest point in the E8 lattice — the densest sphere packing in
|
| 35 |
-
8 dimensions. The result: a **
|
| 36 |
the float32 baseline.
|
| 37 |
|
| 38 |
## Benchmarks
|
|
@@ -41,10 +42,15 @@ the float32 baseline.
|
|
| 41 |
|---|---|---|
|
| 42 |
| STSBenchmark (Spearman) | 0.8637 | **0.8714** (+0.0077) |
|
| 43 |
| STS13 | — | **0.8826** |
|
| 44 |
-
| Index compression | 1x | **
|
| 45 |
-
| Retrieval
|
| 46 |
| Recall@10 (MS-MARCO 1K) | 100% | **100%** |
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
## Usage
|
| 49 |
|
| 50 |
```python
|
|
@@ -54,7 +60,7 @@ import torch, math, torch.nn.functional as F
|
|
| 54 |
model = SentenceTransformer("dfrokido/bge-large-e8-snap")
|
| 55 |
embeddings = model.encode(["What is the capital of France?"], convert_to_tensor=True)
|
| 56 |
embeddings = F.normalize(embeddings.float(), p=2, dim=1)
|
| 57 |
-
# Embeddings are now ready for LatticeMemory indexing —
|
| 58 |
```
|
| 59 |
|
| 60 |
## Training
|
|
@@ -67,8 +73,9 @@ Fine-tuned from `BAAI/bge-large-en-v1.5` using RF-Snap training:
|
|
| 67 |
|
| 68 |
## LatticeMemory
|
| 69 |
|
| 70 |
-
This model powers [LatticeMemory](https://huggingface.co/spaces/dfrokido/LatticeMemory)
|
| 71 |
-
|
| 72 |
-
|
|
|
|
| 73 |
|
| 74 |
Design partner inquiries: dfrokido@gmail.com
|
|
|
|
| 27 |
**bge-large-en-v1.5 fine-tuned with RF-Snap to align embeddings to the E8 lattice.**
|
| 28 |
|
| 29 |
Part of the [LatticeMemory](https://huggingface.co/spaces/dfrokido/LatticeMemory) project.
|
| 30 |
+
[**GitHub →**](https://github.com/sangmorg1-debug/latticememory)
|
| 31 |
|
| 32 |
## What Makes This Different
|
| 33 |
|
| 34 |
Standard embedding models output float32 vectors. This model is trained so its outputs
|
| 35 |
naturally snap to the nearest point in the E8 lattice — the densest sphere packing in
|
| 36 |
+
8 dimensions. The result: a **32x smaller** index with **better STS quality** than
|
| 37 |
the float32 baseline.
|
| 38 |
|
| 39 |
## Benchmarks
|
|
|
|
| 42 |
|---|---|---|
|
| 43 |
| STSBenchmark (Spearman) | 0.8637 | **0.8714** (+0.0077) |
|
| 44 |
| STS13 | — | **0.8826** |
|
| 45 |
+
| Index compression | 1x | **32x** |
|
| 46 |
+
| Retrieval @ 100K docs | 20.8 ms (scan) | **O(1) on E8 key hit** |
|
| 47 |
| Recall@10 (MS-MARCO 1K) | 100% | **100%** |
|
| 48 |
|
| 49 |
+
> **Compression basis:** 1 address byte per 8-dim block × 128 blocks = 128 bytes for a
|
| 50 |
+
> 1024-dim embedding, vs 4,096 bytes for float32 = 32x. This applies to E8 key storage;
|
| 51 |
+
> see [LatticeMemory](https://github.com/sangmorg1-debug/latticememory) for hybrid mode,
|
| 52 |
+
> which also stores a dense fallback index for asymmetric retrieval.
|
| 53 |
+
|
| 54 |
## Usage
|
| 55 |
|
| 56 |
```python
|
|
|
|
| 60 |
model = SentenceTransformer("dfrokido/bge-large-e8-snap")
|
| 61 |
embeddings = model.encode(["What is the capital of France?"], convert_to_tensor=True)
|
| 62 |
embeddings = F.normalize(embeddings.float(), p=2, dim=1)
|
| 63 |
+
# Embeddings are now ready for LatticeMemory indexing — 32x smaller index
|
| 64 |
```
|
| 65 |
|
| 66 |
## Training
|
|
|
|
| 73 |
|
| 74 |
## LatticeMemory
|
| 75 |
|
| 76 |
+
This model powers [LatticeMemory](https://huggingface.co/spaces/dfrokido/LatticeMemory)
|
| 77 |
+
([GitHub](https://github.com/sangmorg1-debug/latticememory), `pip install latticememory`) —
|
| 78 |
+
a semantic cache, dedup, and hybrid memory library for LLM applications. 32x compressed
|
| 79 |
+
E8 keys for instant repeat-query cache hits, dense fallback for novel retrieval.
|
| 80 |
|
| 81 |
Design partner inquiries: dfrokido@gmail.com
|