File size: 6,260 Bytes
9da5e5c
93f6723
 
9da5e5c
93f6723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9da5e5c
93f6723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bd1ec53
 
93f6723
 
bd1ec53
 
 
93f6723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bd1ec53
93f6723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
---
language:
- en
license: apache-2.0
tags:
- sentence-transformers
- rag
- universal-embedding
- matryoshka
- embeddings
- information-retrieval
base_model: nomic-ai/modernbert-embed-base
pipeline_tag: sentence-similarity
library_name: sentence-transformers
model-index:
- name: TensorFluxEmbedder
  results:
  - task:
      type: information-retrieval
    dataset:
      name: SciFact
      type: scifact
    metrics:
    - type: ndcg_at_10
      value: 0.718
  - task:
      type: information-retrieval
    dataset:
      name: Legal RAG
      type: custom
    metrics:
    - type: ndcg_at_10
      value: 0.422
---

# TensorFluxEmbedder

TensorFluxEmbedder is a fine-tuned text embedding model covering four domains β€” general language, web search, scientific literature, and legal documents. Embeddings can be truncated from 768 β†’ 512 β†’ 256 β†’ 128 β†’ 64 dimensions at inference time with no retraining, letting you directly trade retrieval quality for speed and memory.

## Model Specifications

| Property | Value |
|---|---|
| **Architecture** | ModernBERT |
| **Embedding dimensions** | 768, 512, 256, 128, 64 |
| **Max input length** | 8,192 tokens |
| **Similarity metric** | Cosine |
| **Language** | English |
| **License** | Apache 2.0 |

## Performance

<div align="center">

![TensorFluxEmbedder Performance Chart](assets/TensorFluxEmbedderPerformance.png)

</div>


NDCG@10 on held-out test sets across all five supported dimensionalities:

| Dims | SciFact NDCG@10 | Legal NDCG@10 | Vector size vs 768d |
|-----:|:---:|:---:|:---:|
| **768** | **0.718** | **0.422** | 100% |
| 512 | 0.707 | 0.417 | 67% |
| 256 | 0.697 | 0.400 | 33% |
| 128 | 0.665 | 0.345 | 17% |
| 64  | 0.587 | 0.278 | 8%  |

**256 dimensions** is the recommended default for latency-sensitive RAG: it retains 97% of peak SciFact quality at one-third the storage cost.

## Full Evaluation Results

### SciFact (held-out test set)

| Metric | 768d | 512d | 256d | 128d | 64d |
|---|:---:|:---:|:---:|:---:|:---:|
| Accuracy@1  | 0.603 | 0.603 | 0.580 | 0.543 | 0.447 |
| Accuracy@10 | 0.860 | 0.843 | 0.840 | 0.810 | 0.743 |
| Recall@1    | 0.576 | 0.573 | 0.553 | 0.524 | 0.434 |
| Recall@10   | 0.851 | 0.831 | 0.829 | 0.795 | 0.727 |
| **NDCG@10** | **0.718** | **0.707** | **0.697** | **0.665** | **0.587** |
| MRR@10      | 0.683 | 0.675 | 0.663 | 0.631 | 0.549 |
| MAP@100     | 0.678 | 0.670 | 0.656 | 0.625 | 0.544 |

### Legal RAG (held-out 10% split)

| Metric | 768d | 512d | 256d | 128d | 64d |
|---|:---:|:---:|:---:|:---:|:---:|
| Accuracy@1  | 0.158 | 0.161 | 0.145 | 0.107 | 0.093 |
| Accuracy@10 | 0.702 | 0.692 | 0.675 | 0.598 | 0.491 |
| Recall@1    | 0.158 | 0.161 | 0.145 | 0.107 | 0.093 |
| Recall@10   | 0.702 | 0.692 | 0.675 | 0.598 | 0.491 |
| **NDCG@10** | **0.422** | **0.417** | **0.400** | **0.345** | **0.278** |
| MRR@10      | 0.332 | 0.329 | 0.312 | 0.265 | 0.212 |
| MAP@100     | 0.342 | 0.338 | 0.321 | 0.276 | 0.224 |

The legal corpus uses a 1:1 query-to-passage evaluation scheme where each query has exactly one relevant passage in the full corpus, making the task harder than typical multi-relevant benchmarks.

## Usage

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

Always prefix your inputs to distinguish query intent from document content:

| Input type | Prefix |
|---|---|
| Search query | `search_query: ` |
| Document / passage | `search_document: ` |

```python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("IstishadAlamTishad/TensorFluxEmbedder")

queries = [
    "search_query: What are the procurement rules for small business government contracts?",
]
documents = [
    "search_document: Agency procurement regulations require that small business offerors "
    "receive fair opportunities pursuant to FAR Part 19.",
    "search_document: Antibody neutralization of SARS-CoV-2 spike protein prevents viral "
    "entry into host cells via the ACE2 receptor pathway.",
]

q_emb = model.encode(queries,   normalize_embeddings=True)
d_emb = model.encode(documents, normalize_embeddings=True)

scores = model.similarity(q_emb, d_emb)
print(scores)
# tensor([[0.79, 0.51]])
```

### Choosing an embedding dimension

Set `truncate_dim` at load time β€” no extra downloads, no retraining required:

```python
# Full quality (768d)
model = SentenceTransformer("IstishadAlamTishad/TensorFluxEmbedder")

# Recommended for RAG: 97% quality at 1/3 storage (256d)
model = SentenceTransformer("IstishadAlamTishad/TensorFluxEmbedder", truncate_dim=256)

# Fastest retrieval, ~82% of peak quality (64d)
model = SentenceTransformer("IstishadAlamTishad/TensorFluxEmbedder", truncate_dim=64)
```

## Limitations

- **English only** β€” trained exclusively on English-language corpora; not expected to perform well on non-English text.
- **Max 8192 tokens** β€” inputs longer than 8192 tokens will be silently truncated. Split long documents into chunks before encoding.
- **Prefix required** β€” always apply the correct prefix (`search_query:` / `search_document:`). Omitting it will noticeably degrade retrieval quality.
- **Legal domain scope** β€” legal evaluation was performed on a single corpus with a 1:1 query-to-passage scheme. Performance on other legal datasets may differ.
- **Retrieval only** β€” optimized for dense retrieval; not suitable for use as a cross-encoder, classifier, or NLI model.

## Citation

If you use TensorFluxEmbedder in your work, please cite:

```bibtex
@misc{tishad2026tensorfluxembedder,
  author    = {Istishad Alam Tishad},
  title     = {TensorFluxEmbedder: A Multi-Domain Embedding Model},
  year      = {2026},
  url       = {https://huggingface.co/IstishadAlamTishad/TensorFluxEmbedder},
  note      = {HuggingFace model repository}
}
```

## Acknowledgements

**Sentence Transformers**

```bibtex
@inproceedings{reimers-2019-sentence-bert,
    title     = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author    = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month     = "11",
    year      = "2019",
    publisher = "Association for Computational Linguistics",
    url       = "https://arxiv.org/abs/1908.10084",
}
```