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 public-facing claims: caveat E8-exact-match scope, remove unqualified 100% Recall@10 figure, point to library README's verified per-mode numbers
Browse files
README.md
CHANGED
|
@@ -29,27 +29,45 @@ model-index:
|
|
| 29 |
Part of the [LatticeMemory](https://huggingface.co/spaces/dfrokido/LatticeMemory) project.
|
| 30 |
[**GitHub β**](https://github.com/sangmorg1-debug/latticememory)
|
| 31 |
|
| 32 |
-
## What
|
| 33 |
|
| 34 |
Standard embedding models output float32 vectors. This model is trained so its outputs
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
## Benchmarks
|
| 40 |
|
|
|
|
|
|
|
| 41 |
| Metric | Float baseline (bge-large-en-v1.5) | This model |
|
| 42 |
|---|---|---|
|
| 43 |
| STSBenchmark (Spearman) | 0.8637 | **0.8714** (+0.0077) |
|
| 44 |
| STS13 | β | **0.8826** |
|
| 45 |
-
|
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|
|
@@ -60,7 +78,9 @@ import torch, math, torch.nn.functional as F
|
|
| 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
|
|
|
|
|
|
|
| 64 |
```
|
| 65 |
|
| 66 |
## Training
|
|
@@ -74,8 +94,17 @@ Fine-tuned from `BAAI/bge-large-en-v1.5` using RF-Snap training:
|
|
| 74 |
## LatticeMemory
|
| 75 |
|
| 76 |
This model powers [LatticeMemory](https://huggingface.co/spaces/dfrokido/LatticeMemory)
|
| 77 |
-
([GitHub](https://github.com/sangmorg1-debug/latticememory)
|
| 78 |
-
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
Design partner inquiries: dfrokido@gmail.com
|
|
|
|
| 29 |
Part of the [LatticeMemory](https://huggingface.co/spaces/dfrokido/LatticeMemory) project.
|
| 30 |
[**GitHub β**](https://github.com/sangmorg1-debug/latticememory)
|
| 31 |
|
| 32 |
+
## What this model is for
|
| 33 |
|
| 34 |
Standard embedding models output float32 vectors. This model is trained so its outputs
|
| 35 |
+
snap to the nearest point in the E8 lattice β the densest sphere packing in 8 dimensions β
|
| 36 |
+
giving a compact 128-byte address alongside the usual embedding. That address is a reliable,
|
| 37 |
+
O(1) match for **identical or near-identical text** (exact-repeat caching, deduplication,
|
| 38 |
+
closed-vocabulary intent matching). It is **not** a general semantic-search replacement: the
|
| 39 |
+
E8 address alone does not reliably match open-vocabulary paraphrases or asymmetric
|
| 40 |
+
query/passage pairs. See [LatticeMemory's README](https://github.com/sangmorg1-debug/latticememory#readme)
|
| 41 |
+
for the current, verified breakdown of which retrieval mode to use for which workload β
|
| 42 |
+
including a documented case (held-out CLINC150 intents) where the E8 address mechanism
|
| 43 |
+
scored 0.00% and Product Quantization, not the E8 lattice, is the component that gets real
|
| 44 |
+
paraphrase recall (31% Recall@1 on PAWS).
|
| 45 |
|
| 46 |
## Benchmarks
|
| 47 |
|
| 48 |
+
What's verified about the *model itself*, independent of retrieval mode:
|
| 49 |
+
|
| 50 |
| Metric | Float baseline (bge-large-en-v1.5) | This model |
|
| 51 |
|---|---|---|
|
| 52 |
| STSBenchmark (Spearman) | 0.8637 | **0.8714** (+0.0077) |
|
| 53 |
| STS13 | β | **0.8826** |
|
| 54 |
+
| E8 key size vs. float32 | 4,096 bytes | **128 bytes (32x smaller)** |
|
| 55 |
+
|
| 56 |
+
The STS gain is real but modest β this model is not meaningfully "better at search" than
|
| 57 |
+
the float baseline; it's the same quality embedding with an added property (E8-snappable
|
| 58 |
+
outputs). The 32x figure is a storage-size fact (1 address byte per 8-dim block Γ 128
|
| 59 |
+
blocks), not a recall or accuracy claim β recall/accuracy depend entirely on which
|
| 60 |
+
LatticeMemory retrieval mode you use on top of it. An earlier version of this card quoted
|
| 61 |
+
"100% Recall@10 on MS-MARCO (1K docs)" without the retrieval-mode context; that number came
|
| 62 |
+
from a small-scale exact/near-exact-repeat test, not asymmetric passage retrieval β see the
|
| 63 |
+
library README's own benchmark table for the real, mode-by-mode picture (including where
|
| 64 |
+
this mechanism scores 0% on real asymmetric RAG).
|
| 65 |
|
| 66 |
> **Compression basis:** 1 address byte per 8-dim block Γ 128 blocks = 128 bytes for a
|
| 67 |
+
> 1024-dim embedding, vs 4,096 bytes for float32 = 32x. This applies to E8 key storage only;
|
| 68 |
> see [LatticeMemory](https://github.com/sangmorg1-debug/latticememory) for hybrid mode,
|
| 69 |
+
> which also stores a dense (Int8/float32) fallback index for asymmetric retrieval β that
|
| 70 |
+
> fallback, not the E8 key, is what actually serves paraphrase/RAG queries today.
|
| 71 |
|
| 72 |
## Usage
|
| 73 |
|
|
|
|
| 78 |
model = SentenceTransformer("dfrokido/bge-large-e8-snap")
|
| 79 |
embeddings = model.encode(["What is the capital of France?"], convert_to_tensor=True)
|
| 80 |
embeddings = F.normalize(embeddings.float(), p=2, dim=1)
|
| 81 |
+
# Embeddings are now ready for LatticeMemory indexing.
|
| 82 |
+
# For open-vocabulary text, use LatticeMemory's mode="pq" (Product Quantization) β
|
| 83 |
+
# not the raw E8 exact-match key β see the library README for why.
|
| 84 |
```
|
| 85 |
|
| 86 |
## Training
|
|
|
|
| 94 |
## LatticeMemory
|
| 95 |
|
| 96 |
This model powers [LatticeMemory](https://huggingface.co/spaces/dfrokido/LatticeMemory)
|
| 97 |
+
([GitHub](https://github.com/sangmorg1-debug/latticememory)) β a semantic cache, dedup, and
|
| 98 |
+
hybrid memory library for LLM applications.
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
pip install lattice-memory-e8 # import name is still `latticememory`
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
E8 keys give O(1) hits for exact/near-exact repeat queries and cheap deduplication. For
|
| 105 |
+
open-ended paraphrase caching, use the library's Product Quantization mode; for asymmetric
|
| 106 |
+
QA/RAG, use hybrid mode with its dense fallback. The library's own README documents which
|
| 107 |
+
mode is validated for which workload, including the cases that don't work β read that before
|
| 108 |
+
choosing a mode for production.
|
| 109 |
|
| 110 |
Design partner inquiries: dfrokido@gmail.com
|