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
Download README.md from MatterWaveAI/grt-30m-embedding: direct link, hf CLI and curl.
- Browser
- Download file 8.86 kB
-
https://huggingface.co/MatterWaveAI/grt-30m-embedding/resolve/main/README.md
- Command line
-
hf download hf://MatterWaveAI/grt-30m-embedding/README.md
-
curl -L -o README.md https://huggingface.co/MatterWaveAI/grt-30m-embedding/resolve/main/README.md
license: apache-2.0
tags:
- grt
- geometric-rotation-transformer
- sentence-transformers
- feature-extraction
- sentence-similarity
- circular-pooling
- rotational
- qwen3
datasets:
- sentence-transformers/all-nli
- sentence-transformers/stsb
language:
- en
library_name: sentence-transformers
pipeline_tag: sentence-similarity
base_model: MatterWaveAI/grt-30m
GRT-30M-Embedding (Circular-Pooled Rotational Sentence Encoder)
An embedding-only Geometric Rotation Transformer (GRTModel) contrastively fine-tuned from MatterWaveAI/grt-30m for semantic textual similarity and dense retrieval using planar-pair circular pooling (sentence-transformers).
Instead of dense linear projections (nn.Linear), GRT represents token embeddings in polar coordinates (phase_angles + log_magnitude) and transforms hidden states through cascades of content-modulated 2×2 Givens rotations on SO(D) interleaved with butterfly permutations. Because every hidden state is structured as D / 2 = 128 planar (x, y) coordinate pairs, circular pooling decomposes each pair into its unit direction (cos θ, sin θ) and radius r, averages the unit directions and radii across non-padding tokens, and recombines them into a 256-dimensional sentence embedding.
Model Details
| Property | Value |
|---|---|
| Architecture | GRTModel (model_type: "grt", encoder/backbone without causal LM head) |
| Base model | MatterWaveAI/grt-30m |
| Pooling strategy | circular (Pooling(embedding_dimension=256, pooling_mode="circular") + Normalize) |
| Output dimensionality | 256 (128 planar (x, y) pairs, L2-normalized) |
| Total stored parameters | 29,305,497 (29.31M, lm_head.output_scale stripped) |
| Non-embedding backbone parameters | 9,740,197 (9.74M across 12 rotational blocks) |
hidden_size (d_model) |
256 |
num_hidden_layers (n_blocks) |
12 |
num_attention_heads (n_heads) |
4 (head_dim = 64) |
intermediate_size (d_ff) |
1,024 |
n_qkv_rotations / n_mixer_rotations / ffn_n_rotations |
11 / 1 / 21 |
| Vocabulary | 151,669 (Qwen 3 BPE) |
| Max sequence length | 512 (supports up to 2,048 positions) |
Two-Stage Contrastive Fine-Tuning Method (Intel Arc XPU)
Starting from the pretrained 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):
| Stage | Dataset & Budget | Objective & Hyperparameters |
|---|---|---|
| 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 |
| 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, PairAdam(lr=1.5e-4, coupling_lr_mult=3.0, max_angular_step=0.05) |
| 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, PairAdam(lr=8e-5, coupling_lr_mult=3.0, max_angular_step=0.05) |
Evaluation Results (STS-B)
Evaluated on the STS Benchmark (sentence-transformers/stsb) validation and test splits using circular pooling and cosine similarity:
| Split | Metric | GRT-30M (Pretrained Base) |
GRT-30M-Embedding (PairAdam) |
AdamW Ablation¹ |
Delta (PairAdam vs. Base) |
|---|---|---|---|---|---|
| STS-B Validation | Spearman (×100) |
45.51 |
71.79 |
72.89 |
+26.28 |
| STS-B Test | Spearman (×100) |
28.49 |
62.42 |
63.17 |
+33.93 |
| STS-B Test | Pearson (×100) |
29.81 |
63.30 |
63.72 |
+33.49 |
¹ Optimizer comparison note: The published checkpoint is trained with
PairAdam(zero weight decay and[-π, π]wrapping on rotation angles,max_angular_step = 0.05, and rank-1 factored second moments with a3×learning-rate multiplier onCl(2,0)coupling tensors) for consistency withGRT-30Mpretraining. In a head-to-head run on the identical508-step schedule and random seed (42), standardAdamW(1×coupling LR, full diagonal second moments) reaches72.89Val /63.17Test Spearman (+1.10/+0.75points), indicating that whilePairAdam's factored moments and3×coupling LR multiplier stabilize large-batch (524ktok/step) pretraining from scratch, standard diagonal moments at1×coupling LR are slightly gentler during short, small-batch (B = 32) downstream fine-tuning.
Usage
1. sentence-transformers (Recommended)
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("MatterWaveAI/grt-30m-embedding")
sentences = [
"Plants convert sunlight into chemical energy through photosynthesis.",
"Chlorophyll absorbs light energy to synthesize glucose in plant leaves.",
"The stock market experienced volatility during the afternoon session.",
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities)
2. Hugging Face transformers (GRTModel + Circular Pooling)
import torch
import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer
model_id = "MatterWaveAI/grt-30m-embedding"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id).eval()
def circular_pool(token_embeddings: torch.Tensor, attention_mask: torch.Tensor) -> torch.Tensor:
pairs = token_embeddings.float().unflatten(-1, (-1, 2))
mask = attention_mask.float().unsqueeze(-1).unsqueeze(-1)
radii = pairs.norm(dim=-1, keepdim=True)
directions = pairs / torch.clamp(radii, min=1e-9)
denom = torch.clamp(mask.sum(dim=1), min=1e-9)
pooled = ((directions * mask).sum(dim=1) / denom) * ((radii * mask).sum(dim=1) / denom)
return F.normalize(pooled.flatten(start_dim=1), p=2, dim=-1).to(token_embeddings.dtype)
inputs = tokenizer(
["How does photosynthesis work?", "Plants convert sunlight into chemical energy."],
padding=True,
truncation=True,
return_tensors="pt",
)
with torch.no_grad():
outputs = model(**inputs)
embeddings = circular_pool(outputs.last_hidden_state, inputs["attention_mask"])
print("Cosine similarity:", float((embeddings[0] @ embeddings[1]).item()))
Complete MatterWaveAI/grt-30m* Research Suite on Hugging Face
- Base Causal LM:
MatterWaveAI/grt-30m - Chat Fine-Tune:
MatterWaveAI/grt-30m-chat - 4-Expert Mixture-of-Rotations (
MoR):MatterWaveAI/grt-30m-mor - Circular-Pooled Sentence Embedding:
MatterWaveAI/grt-30m-embedding - Cross-Encoder Reranker:
MatterWaveAI/grt-30m-reranker - Vision-Language (
GRTVL):MatterWaveAI/grt-30m-vl - Canonical Tokenizer & Polar Embedding Bank:
MatterWaveAI/grt-30m-tokenizer
- Whitepaper: The Geometric Rotation Transformer (GRT): A Purely Rotational Foundation Architecture (
GRT_Whitepaper.pdf)
License
Apache 2.0
Citation
@techreport{householter2026grt,
title = {The Geometric Rotation Transformer: A Purely Rotational Foundation Architecture},
author = {Householter, David},
institution = {MatterWave AI},
year = {2026},
url = {https://matterwave.ai}
}