Update README.md
Browse files
README.md
CHANGED
|
@@ -2,9 +2,98 @@
|
|
| 2 |
title: README
|
| 3 |
emoji: π
|
| 4 |
colorFrom: indigo
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
title: README
|
| 3 |
emoji: π
|
| 4 |
colorFrom: indigo
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
license: mit
|
| 9 |
---
|
| 10 |
+
<!--
|
| 11 |
+
QuerynAi β Hugging Face organization card.
|
| 12 |
+
Local draft (git-ignored). Paste into the org card at
|
| 13 |
+
https://huggingface.co/organizations/QuerynAi/settings β or the QuerynAi/README repo.
|
| 14 |
+
Fill the <β¦> placeholders before publishing.
|
| 15 |
+
-->
|
| 16 |
|
| 17 |
+
# Queryn β Embedding Translation
|
| 18 |
+
|
| 19 |
+
**Move a corpus between embedding models without re-embedding it.** Given a text
|
| 20 |
+
chunk's embedding in Model A's space, a Queryn adapter returns the equivalent
|
| 21 |
+
vector in Model B's space β so a vector index built with one model can be served
|
| 22 |
+
against another after a lightweight transform instead of a full, expensive
|
| 23 |
+
backfill.
|
| 24 |
+
|
| 25 |
+
## What's in this org
|
| 26 |
+
|
| 27 |
+
The **[Queryn Embedding Adapters](https://huggingface.co/QuerynAi)** collection β
|
| 28 |
+
one small ONNX model per directed model pair (`queryn-adapter-<source>_to_<target>`).
|
| 29 |
+
Each repo contains:
|
| 30 |
+
|
| 31 |
+
- `model.onnx` β the adapter, opset 17, dynamic batch axis. Runs anywhere
|
| 32 |
+
`onnxruntime` runs; no PyTorch needed.
|
| 33 |
+
- `model.safetensors` β the same weights, for retraining / inspection.
|
| 34 |
+
- `config.json` β dimensions, the I/O contract, and provenance.
|
| 35 |
+
- a model card with per-pair metrics and training plots.
|
| 36 |
+
|
| 37 |
+
Every adapter L2-normalizes its input and output internally, so you feed raw
|
| 38 |
+
embeddings straight in and get unit vectors back.
|
| 39 |
+
|
| 40 |
+
## Using an adapter
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
import numpy as np, onnxruntime as ort
|
| 44 |
+
from huggingface_hub import hf_hub_download
|
| 45 |
+
|
| 46 |
+
repo = "QuerynAi/queryn-adapter-ada-002_to_bge-m3"
|
| 47 |
+
sess = ort.InferenceSession(hf_hub_download(repo, "model.onnx"),
|
| 48 |
+
providers=["CPUExecutionProvider"])
|
| 49 |
+
|
| 50 |
+
src = np.random.rand(8, 1536).astype(np.float32) # your ada-002 embeddings
|
| 51 |
+
tgt = sess.run(["target_embedding"], {"source_embedding": src})[0]
|
| 52 |
+
# tgt: (8, 1024) unit vectors in bge-m3 space
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## How the adapters are built
|
| 56 |
+
|
| 57 |
+
- One **linear** projection and one **1-hidden-layer GELU MLP** (with a
|
| 58 |
+
compressed latent below both dimensions) are trained per pair; whichever scores
|
| 59 |
+
higher on held-out cosine similarity is published, ties to linear. Each pair's
|
| 60 |
+
card reports both, so the linear-vs-nonlinear trade-off is visible.
|
| 61 |
+
- Trained on a unified **~349,674-row, five-domain corpus** (arXiv abstracts,
|
| 62 |
+
Australian case law, SQuAD passages, PubMed RCT abstracts, financial/markets
|
| 63 |
+
news), optimizing `1 β mean cosine similarity` with Adam and LR scheduling.
|
| 64 |
+
- Some embedding spaces are near-isomorphic and align well with a single matrix;
|
| 65 |
+
others need the nonlinear map and still lose accuracy. Check the card metrics
|
| 66 |
+
for your pair before relying on it β translation is an approximation, not a
|
| 67 |
+
substitute for re-embedding when fidelity is critical.
|
| 68 |
+
|
| 69 |
+
## Model coverage
|
| 70 |
+
|
| 71 |
+
| Model | Dim | Role in v1 |
|
| 72 |
+
|---|---|---|
|
| 73 |
+
| `ada-002` | 1536 | source only (deprecated as a target) |
|
| 74 |
+
| `te3-small` | 1536 | source + target |
|
| 75 |
+
| `qwen3-emb-8b` | 4096 | source + target |
|
| 76 |
+
| `bge-m3` | 1024 | source + target |
|
| 77 |
+
| `me5-large` | 1024 | source + target |
|
| 78 |
+
| `pplx-embed-1` | 1024 | source + target |
|
| 79 |
+
| `nemotron-1b-free` | 2048 | source + target |
|
| 80 |
+
| `fastembed-bge-small` | 384 | source + target |
|
| 81 |
+
|
| 82 |
+
49 directed pairs in the current (v1) generation.
|
| 83 |
+
|
| 84 |
+
## Links
|
| 85 |
+
|
| 86 |
+
- **Code & pipeline:** <GitHub repo URL>
|
| 87 |
+
- **Training corpus + paired embeddings:** <Kaggle dataset URL>
|
| 88 |
+
- **Papers behind the approach:** Vec2Vec ([arXiv:2306.12689](https://arxiv.org/abs/2306.12689)),
|
| 89 |
+
mini-vec2vec ([arXiv:2510.02348](https://arxiv.org/abs/2510.02348))
|
| 90 |
+
|
| 91 |
+
## License
|
| 92 |
+
|
| 93 |
+
Adapter models: **MIT**. The Queryn codebase: **Apache-2.0**. Training data keeps
|
| 94 |
+
each source corpus's own license β see the dataset's `LICENSE` manifest.
|
| 95 |
+
|
| 96 |
+
## Status
|
| 97 |
+
|
| 98 |
+
An independent research project on practical embedding-space alignment. Issues and
|
| 99 |
+
findings welcome via the repo; the adapters are provided as-is.
|