Sentence Similarity
sentence-transformers
Safetensors
English
grt
geometric-rotation-transformer
feature-extraction
circular-pooling
rotational
qwen3
Instructions to use MatterWaveAI/grt-30m-embedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use MatterWaveAI/grt-30m-embedding with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("MatterWaveAI/grt-30m-embedding") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
docs: document two-stage contrastive fine-tuning method on Intel Arc XPU
Browse files
README.md
CHANGED
|
@@ -47,6 +47,18 @@ Instead of dense linear projections (`nn.Linear`), GRT represents token embeddin
|
|
| 47 |
|
| 48 |
---
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
## Evaluation Results (STS-B)
|
| 51 |
|
| 52 |
Evaluated on the **STS Benchmark (`sentence-transformers/stsb`)** validation and test splits using `circular` pooling and cosine similarity:
|
|
|
|
| 47 |
|
| 48 |
---
|
| 49 |
|
| 50 |
+
## Two-Stage Contrastive Fine-Tuning Method (Intel Arc XPU)
|
| 51 |
+
|
| 52 |
+
Starting from the pretrained [`MatterWaveAI/grt-30m`](https://huggingface.co/MatterWaveAI/grt-30m) causal checkpoint (`lm_head.output_scale` stripped to form a headless `GRTModel` encoder), the `151,669` lexical `embedding.phase_angles` (`19.41M` parameters) were frozen to preserve the pretrained Qwen 3 polar token geometry while training the **`9,740,196` rotational backbone parameters + `151,669` token `log_magnitude` weights (`9,891,865` trainable parameters)** in `FP32` on an **Intel Arc 140T GPU (`xpu:0`, 32 GB)** using fused oneAPI DPC++ SYCL Givens and Clifford kernels (`~75s` total wall-clock time):
|
| 53 |
+
|
| 54 |
+
| Stage | Dataset & Budget | Objective & Hyperparameters |
|
| 55 |
+
|---|---|---|
|
| 56 |
+
| **Parameter Freezing** | `embedding.phase_angles` frozen (`19.41M` params) | `9,891,865` trainable parameters (`12` rotational blocks + `embedding.log_magnitude`); max grad norm `1.0` |
|
| 57 |
+
| **Stage 1: AllNLI Contrastive Alignment** | `sentence-transformers/all-nli` (`triplet` split) 路 `150 steps` (`4,800` triplets, `<1%` of corpus) | In-batch `MultipleNegativesRankingLoss` + explicit hard negatives (`蟿 = 0.05`), `batch_size = 32`, `max_length = 96`, `AdamW(lr=1.5e-4, weight_decay=0.01)` |
|
| 58 |
+
| **Stage 2: STS-B Rank & Metric Calibration** | `sentence-transformers/stsb` (`train` split, `5,749` pairs) 路 `2 epochs` (`358 steps`) | `CoSENT` rank-consistency loss (`蟿 = 20.0`) + `2.0 脳 CosineMSE`, `batch_size = 32`, `max_length = 128`, `AdamW(lr=8e-5, weight_decay=0.01)` |
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
## Evaluation Results (STS-B)
|
| 63 |
|
| 64 |
Evaluated on the **STS Benchmark (`sentence-transformers/stsb`)** validation and test splits using `circular` pooling and cosine similarity:
|