Feature Extraction
sentence-transformers
Safetensors
English
llama_bidirec
dense-retrieval
information-retrieval
oblique-retrieval
authorship
stylometry
custom_code
text-embeddings-inference
Instructions to use DataScience-UIBK/OBLIQ-IR-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use DataScience-UIBK/OBLIQ-IR-3B with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("DataScience-UIBK/OBLIQ-IR-3B", trust_remote_code=True) 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
Correct usage: no task-instruction prefix (matches how the model was trained and evaluated)
Browse files
README.md
CHANGED
|
@@ -58,23 +58,33 @@ from sentence_transformers import SentenceTransformer
|
|
| 58 |
|
| 59 |
model = SentenceTransformer("DataScience-UIBK/OBLIQ-IR-3B", trust_remote_code=True)
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
"writing": "Given a prose snippet, retrieve other snippets by the same author across different topics, based on stylistic fingerprint.",
|
| 64 |
-
"math": "Given an example problem, retrieve other math problems whose solutions share the same abstract reasoning technique.",
|
| 65 |
-
"twitter": "Retrieve tweets that implicitly express the latent stance described in the query, without surface mention of the topic.",
|
| 66 |
-
"congress": "Retrieve the specific Congressional hearing passage matching the user's lossy recollection of the exchange.",
|
| 67 |
-
}
|
| 68 |
|
| 69 |
-
q = model.encode(["query: "
|
| 70 |
-
d = model.encode(["passage: " +
|
| 71 |
|
| 72 |
-
# rank by cosine similarity
|
| 73 |
scores = model.similarity(q, d)
|
| 74 |
```
|
| 75 |
|
| 76 |
-
**The `query: `
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
## How it was trained
|
| 80 |
|
|
|
|
| 58 |
|
| 59 |
model = SentenceTransformer("DataScience-UIBK/OBLIQ-IR-3B", trust_remote_code=True)
|
| 60 |
|
| 61 |
+
queries = ["A passage written with the same restless, aphoristic voice as this one."]
|
| 62 |
+
documents = ["...your corpus documents..."]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
+
q = model.encode(["query: " + x for x in queries])
|
| 65 |
+
d = model.encode(["passage: " + x for x in documents])
|
| 66 |
|
|
|
|
| 67 |
scores = model.similarity(q, d)
|
| 68 |
```
|
| 69 |
|
| 70 |
+
**The `query: ` and `passage: ` prefixes are required** — the model was trained with them, and dropping
|
| 71 |
+
them changes the embedding. Queries take no other prefix.
|
| 72 |
+
|
| 73 |
+
> **Note on task instructions.** The training file carries a per-task instruction string alongside each
|
| 74 |
+
> query, but the training script consumes only the query text, and the evaluation that produced every
|
| 75 |
+
> number in the paper encodes the raw benchmark query with the `query: ` prefix alone. **Do not prepend a
|
| 76 |
+
> task instruction** — the released checkpoint was neither trained nor evaluated with one, so adding one
|
| 77 |
+
> moves you off-distribution. Task identity is carried by the mixture the model was trained on, not by a
|
| 78 |
+
> runtime prefix.
|
| 79 |
+
|
| 80 |
+
Truncate documents at 1024 tokens and queries at 256 to match the paper's evaluation:
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
model.max_seq_length = 1024 # documents
|
| 84 |
+
d = model.encode(["passage: " + x for x in documents])
|
| 85 |
+
model.max_seq_length = 256 # queries
|
| 86 |
+
q = model.encode(["query: " + x for x in queries])
|
| 87 |
+
```
|
| 88 |
|
| 89 |
## How it was trained
|
| 90 |
|