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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
---
language:
  - en
license: mit
library_name: sentence-transformers
pipeline_tag: feature-extraction
base_model: BAAI/bge-small-en-v1.5
model-index:
  - name: Mirror Memory Default Embedding Model
    results:
      - task:
          type: information-retrieval
          name: Information Retrieval
        dataset:
          type: gooaq
          name: GooAQ
        metrics:
          - type: recall_at_1
            value: 0.8237
            name: Recall@1
          - type: ndcg_at_10
            value: 0.9075
            name: NDCG@10
          - type: mrr_at_10
            value: 0.8837
            name: MRR@10
datasets:
  - sentence-transformers/gooaq
tags:
  - sentence-transformers
  - embeddings
  - text-embeddings
  - semantic-search
  - information-retrieval
  - rag
  - retrieval
  - bge
  - bert
---

# Mirror Memory Default Embedding Model

A fine-tuned English text embedding model developed for **Mirror Memory**, a Rust-based retrieval-augmented generation (RAG) and long-term AI memory library.

This model is based on [`BAAI/bge-small-en-v1.5`](https://huggingface.co/BAAI/bge-small-en-v1.5) and was fine-tuned on a cleaned subset of the **GooAQ** question-answer dataset using `MultipleNegativesRankingLoss`.

The resulting model produces **384-dimensional dense embeddings** and is intended for semantic retrieval workloads such as vector search, RAG, document retrieval, and long-term AI memory.

---

## Model Details

| Property | Value |
|---|---|
| Model | Mirror Memory Default Embedding Model |
| Base model | `BAAI/bge-small-en-v1.5` |
| Architecture | BERT |
| Language | English |
| Embedding dimension | 384 |
| Maximum sequence length | 512 tokens |
| Pooling | CLS |
| Normalization | L2 normalization |
| Training objective | Multiple Negatives Ranking Loss |
| Training dataset | GooAQ |
| Training subset | ~30,000 cleaned samples |
| Weight format | SafeTensors |
| Intended tasks | Semantic search, retrieval, RAG, AI memory |

---

## Motivation

Mirror Memory uses vector embeddings to convert documents and text into representations that can be efficiently stored and retrieved from a vector database.

The default embedding model is designed to provide a compact embedding representation while remaining practical for local and resource-conscious inference.

It is intended to work particularly well for:

- Semantic search
- Retrieval-Augmented Generation (RAG)
- Long-term AI memory
- Document retrieval
- Question-answer retrieval
- Similarity search
- Knowledge-base retrieval
- Vector databases

---

## Training

### Base Model

The model starts from:

**`BAAI/bge-small-en-v1.5`**

The base model is an English BERT-based sentence embedding model with a 384-dimensional output space.

### Pooling and Normalization

The exported model package contains `1_Pooling/config.json` with:

```json
{
  "embedding_dimension": 384,
  "pooling_mode": "cls",
  "include_prompt": true
}
```

Therefore, the shipped model uses **CLS pooling**, not mean pooling.

The package also contains the `2_Normalize` Sentence Transformers module, so the final sentence embeddings are L2-normalized.

### Dataset

Training used a cleaned subset of the **GooAQ** dataset.

- Dataset: [`sentence-transformers/gooaq`](https://huggingface.co/datasets/sentence-transformers/gooaq)
- Training subset: approximately 30,000 samples
- Duplicate entries were removed during preprocessing.
- The training data consists of question-answer pairs.

GooAQ is a large-scale question-answer dataset originally collected from Google search/autocomplete and answer boxes. See the original dataset card for details.

### Objective

The model was fine-tuned using:

```text
MultipleNegativesRankingLoss
```

This training objective encourages semantically related query/document pairs to have closer representations while using other examples in the batch as negative examples.

---

## Evaluation

The model was evaluated using retrieval-oriented metrics on the project's evaluation setup. The structured
`model-index` metadata above exposes these same results to the Hugging Face Hub.

| Metric | Result |
|---|---:|
| Recall@1 | 82.37% |
| NDCG@10 | 90.75% |
| MRR@10 | 88.37% |

These are **project-specific evaluation results**, not official MTEB benchmark results.

For reproducibility, benchmark details such as the exact evaluation split, preprocessing, and evaluation code should be considered alongside the Mirror Memory project source.

---

## Inference

### Sentence Transformers

Install:

```bash
pip install -U sentence-transformers
```

Load the model:

```python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer(
    "KeZZ08/mirror-memory-default-embedding-model"
)

texts = [
    "Rust provides memory safety and high performance.",
    "Retrieval augmented generation combines search with language models.",
    "Vector databases store embeddings for semantic retrieval.",
]

embeddings = model.encode(
    texts,
    normalize_embeddings=True
)

print(embeddings.shape)
# (3, 384)
```

The returned embeddings have **384 dimensions**.

---

## Single Text Embedding

```python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer(
    "KeZZ08/mirror-memory-default-embedding-model"
)

text = "Mirror Memory provides long-term retrieval for AI systems."

embedding = model.encode(
    text,
    normalize_embeddings=True
)

print(embedding.shape)
# (384,)
```

---

## Batch Embedding

For retrieval systems, batch inference is recommended:

```python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer(
    "KeZZ08/mirror-memory-default-embedding-model"
)

documents = [
    "Rust is a systems programming language.",
    "Qdrant is a vector database.",
    "RAG combines retrieval with generation.",
    "Embeddings represent text as numerical vectors.",
]

embeddings = model.encode(
    documents,
    batch_size=32,
    normalize_embeddings=True,
    show_progress_bar=True
)

print(embeddings.shape)
# (4, 384)
```

---

## Similarity Search Example

```python
from sentence_transformers import SentenceTransformer
import numpy as np

model = SentenceTransformer(
    "KeZZ08/mirror-memory-default-embedding-model"
)

query = "How does vector search work?"
documents = [
    "Vector databases store numerical representations of data.",
    "Python is commonly used for machine learning.",
    "Rust provides memory safety without garbage collection.",
]

query_embedding = model.encode(
    query,
    normalize_embeddings=True
)

document_embeddings = model.encode(
    documents,
    normalize_embeddings=True
)

scores = document_embeddings @ query_embedding

for document, score in sorted(
    zip(documents, scores),
    key=lambda x: x[1],
    reverse=True
):
    print(f"{score:.4f}  {document}")
```

Because the embeddings are normalized, the dot product can be used as cosine similarity.

---

## Mirror Memory

This model serves as the default embedding model for the **Mirror Memory** project.

Mirror Memory is a Rust library designed for high-performance:

- Document processing
- Text extraction
- Text cleaning
- Text chunking
- Embedding generation
- Vector storage
- Retrieval-Augmented Generation
- Long-term AI memory

The project supports multiple embedding backends, including custom Hugging Face/Candle models and FastEmbed models.

The model in this repository is the default embedding model intended for Mirror Memory's retrieval pipeline.

---

## Model Architecture

The model retains the BERT-based architecture of the BGE-small-en-v1.5 family.

Key characteristics:

```text
Architecture:        BERT
Hidden size:         384
Transformer layers:  12
Attention heads:     12
Intermediate size:   1536
Maximum sequence:    512 tokens
Embedding size:      384
Pooling:             CLS
Normalization:       L2
```

The exported repository contains the Sentence Transformers configuration required to load the model, including:

```text
1_Pooling/
2_Normalize/
config.json
config_sentence_transformers.json
model.safetensors
modules.json
sentence_bert_config.json
tokenizer.json
tokenizer_config.json
```

---

## Intended Use

This model is intended for English-language embedding and retrieval applications, including:

- Semantic search
- Document similarity
- Question-answer retrieval
- RAG systems
- AI memory systems
- Knowledge-base search
- Vector database indexing
- Clustering and similarity analysis

---

## Limitations

This model should not be treated as a general-purpose generative language model.

It generates embeddings rather than natural-language responses.

Important limitations include:

- The model is optimized for English text.
- Performance can vary across domains that differ substantially from the training data.
- The reported evaluation results come from the project's own evaluation setup.
- The model has not been presented here as an official MTEB benchmark submission.
- As with other embedding models, retrieval quality depends on preprocessing, chunking, query formulation, vector similarity method, and downstream retrieval configuration.

---

## Files

The repository contains the exported Sentence Transformers model:

```text
.
β”œβ”€β”€ 1_Pooling/
β”‚   └── config.json
β”œβ”€β”€ 2_Normalize/
β”‚   └── config.json
β”œβ”€β”€ config.json
β”œβ”€β”€ config_sentence_transformers.json
β”œβ”€β”€ model.safetensors
β”œβ”€β”€ modules.json
β”œβ”€β”€ README.md
β”œβ”€β”€ sentence_bert_config.json
β”œβ”€β”€ tokenizer.json
└── tokenizer_config.json
```

The model weights are provided in **SafeTensors** format.

No Python training checkpoint is required for inference.

---

## Relationship to BGE

This model is a fine-tuned version of:

[`BAAI/bge-small-en-v1.5`](https://huggingface.co/BAAI/bge-small-en-v1.5)

The original BGE model and its documentation are maintained by the Beijing Academy of Artificial Intelligence (BAAI).

This repository contains the fine-tuned model used by Mirror Memory and should not be confused with the original BGE release.

For the original model, architecture details, benchmarks, and upstream documentation, refer to the official BGE model card.

---

## License and Attribution

This repository is released under the **MIT License**.

The model is based on `BAAI/bge-small-en-v1.5`, which is also listed by its official Hugging Face repository under the MIT License.

The training data includes a cleaned subset of GooAQ. The original AllenAI GooAQ dataset is listed under the **Apache License 2.0**. Users should review the original dataset terms and attribution requirements when using this model or building derivative systems.

### Upstream references

- BGE model: https://huggingface.co/BAAI/bge-small-en-v1.5
- GooAQ dataset: https://huggingface.co/datasets/allenai/gooaq
- Sentence Transformers GooAQ: https://huggingface.co/datasets/sentence-transformers/gooaq

---

## Citation

If you use this model in your project, please reference this repository:

```text
KeZZ08/mirror-memory-default-embedding-model
```

For work involving the original BGE model, please also refer to the official BGE publication and model repository.

---

## Disclaimer

This model is provided for research and software-development purposes. Users are responsible for evaluating the model for their own application, data, domain, and deployment requirements.