Text Generation
Transformers
GGUF
PEFT
grt
lora
toroidal-lora
rotational-transformer
givens-rotations
clifford-algebra
sophia-torus
matterwave
Instructions to use MatterWaveAI/grt-30m-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MatterWaveAI/grt-30m-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MatterWaveAI/grt-30m-lora")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MatterWaveAI/grt-30m-lora", device_map="auto") - PEFT
How to use MatterWaveAI/grt-30m-lora with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use MatterWaveAI/grt-30m-lora with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf MatterWaveAI/grt-30m-lora:F16 # Run inference directly in the terminal: llama cli -hf MatterWaveAI/grt-30m-lora:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf MatterWaveAI/grt-30m-lora:F16 # Run inference directly in the terminal: llama cli -hf MatterWaveAI/grt-30m-lora:F16
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf MatterWaveAI/grt-30m-lora:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf MatterWaveAI/grt-30m-lora:F16
Use Docker
docker model run hf.co/MatterWaveAI/grt-30m-lora:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use MatterWaveAI/grt-30m-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MatterWaveAI/grt-30m-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MatterWaveAI/grt-30m-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MatterWaveAI/grt-30m-lora:F16
- SGLang
How to use MatterWaveAI/grt-30m-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MatterWaveAI/grt-30m-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MatterWaveAI/grt-30m-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MatterWaveAI/grt-30m-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MatterWaveAI/grt-30m-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use MatterWaveAI/grt-30m-lora with Ollama:
ollama run hf.co/MatterWaveAI/grt-30m-lora:F16
- Unsloth Desktop
- Docker Model Runner
How to use MatterWaveAI/grt-30m-lora with Docker Model Runner:
docker model run hf.co/MatterWaveAI/grt-30m-lora:F16
- Lemonade
How to use MatterWaveAI/grt-30m-lora with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MatterWaveAI/grt-30m-lora:F16
Run and chat with the model
lemonade run user.grt-30m-lora-F16
List all available models
lemonade list
- Atomic Chat
File size: 9,787 Bytes
aae99bf 6b9f263 aae99bf 6b9f263 aae99bf 6b9f263 aae99bf 6b9f263 aae99bf 83b1214 6b9f263 83b1214 6b9f263 83b1214 aae99bf | 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 | ---
license: apache-2.0
library_name: transformers
pipeline_tag: text-generation
tags:
- grt
- lora
- peft
- toroidal-lora
- rotational-transformer
- givens-rotations
- clifford-algebra
- sophia-torus
- matterwave
base_model: MatterWaveAI/grt-30m
---
# GRT-30M-LoRA (`MatterWaveAI/grt-30m-lora`)
**GRT-30M-LoRA** is the canonical **Toroidal Low-Rank Adaptation (`GRTRotationalLoRA`)** release for [`MatterWaveAI/grt-30m`](https://huggingface.co/MatterWaveAI/grt-30m) (`29,305,498` base parameters, **`0` `nn.Linear` layers**, **`0` `nn.Conv1d` layers**).
Because every projection in a Geometric Rotation Transformer is parameterized by phase angles on the flat torus `T^P = (S¹)^P` and radial scales rather than dense Euclidean weight matrices, standard linear LoRA (`W + B A`) cannot be applied without violating orthogonal/unitary manifold invariants. **`GRTRotationalLoRA`** instead attaches low-rank phase-shift matrices `lora_A` and `lora_B` directly to the butterfly rotation angle tensors:
```text
θ = (θ_base + (α / r) · A B) mod 2π
```
At inference time, `merge_grt_lora(model)` folds `Δθ = (α / r) A B` directly into `θ_base` with **bit-exact equivalence** (`max_abs_diff = 0.0`) and **zero runtime latency or parameter overhead**.
---
## Key Highlights & Metrics
| Metric | Value |
| :--- | :--- |
| **Adapter Class** | `GRTRotationalLoRA` (`transformers.models.grt.lora_grt`) |
| **Base Checkpoint** | [`MatterWaveAI/grt-30m`](https://huggingface.co/MatterWaveAI/grt-30m) (`29,305,498` params) |
| **LoRA Rank (`r`) / Alpha (`α`)** | `r = 8`, `lora_alpha = 16.0` (`scaling = 2.0`) |
| **Trainable LoRA + Scale Parameters** | **`140,741`** (`0.48%` of base model) |
| **Adapter Checkpoint Size** | **`573.3 KB`** (`grt_lora_adapter.safetensors`) |
| **`nn.Linear` / `nn.Conv1d` Layers** | **`0` / `0` (100% Rotational Purity)** |
| **Optimizer** | `HessianPairAdam` (`Sophia-Torus`) / **`SymplecticAdam` (`#1` in 8-way ablation)** |
| **Domain Assistant Loss (Before → After)** | `6.1720` → **`4.7464`** (`HessianPairAdam`) / **`3.9882`** (`SymplecticAdam`) |
| **Domain Perplexity (Before → After)** | `479.14` → **`115.16`** (`HessianPairAdam`) / **`53.96`** (`SymplecticAdam`) |
| **Token Accuracy (Before → After)** | `19.5%` → **`28.8%`** (`HessianPairAdam`) / **`35.3%`** (`SymplecticAdam`) |
| **Pre-Merge vs. Post-Merge `max_abs_diff`** | **`0.0e+00`** (bit-exact across all 8 optimizers) |
---
## 8-Way Classical Geometric Optimizer Ablation (`Spark ROCm gfx1151`)
Because `GRTRotationalLoRA` parametrizes angle tensors (`q_angles`, `k_angles`, `v_angles`, `o_angles`, `coupling_angles`, `expand_angles`, `contract_angles`) with low-rank factors `lora_A` (`[K, r]`) and `lora_B` (`[r, P]`), `build_grt_optimizer` automatically routes all `131,232` LoRA matrix parameters into the toroidal angle group (`is_angle = True`, `weight_decay = 0.0`) and pairs them with their base module's radial scale semi-axes.
We ran a controlled 8-way optimizer ablation on `MatterWaveAI/grt-30m-lora` (`r = 8`, `lora_alpha = 16.0`, `tune_scales = True`, `140,741` trainable parameters, `80` steps: `10` full-depth + `70` cached-prefix top-2-block steps, `lr = 1.8e-2`, `max_angular_step = 0.25`, `CosineAnnealingLR`, `seed = 2026`):
| Rank | Optimizer (`optimizer_type`) | Before Loss | After Assistant Loss | Before PPL | After Perplexity | Before Token Acc | After Token Acc | Merge `max_abs_diff` | Time (s) |
| :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| **1** | **`SymplecticAdam` (`symplectic_adam`)** | `6.1720` | **`3.9882`** | `479.14` | **`53.96`** | `19.54%` | **`35.34%`** | `0.0e+00` | `13.74s` |
| **2** | **`GyricAdam` (`gyric_adam`)** | `6.1720` | `4.3119` | `479.14` | `74.58` | `19.54%` | `31.76%` | `0.0e+00` | `13.82s` |
| **3** | **`PolarNaturalAdam` (`polar_natural_adam`)** | `6.1720` | `4.5078` | `479.14` | `90.72` | `19.54%` | `30.78%` | `0.0e+00` | `13.34s` |
| **4** | **`HessianPairAdam` (`hessian_pair_adam`)** | `6.1720` | `4.5159` | `479.14` | `91.46` | `19.54%` | `30.62%` | `0.0e+00` | `13.26s` |
| **5** | **`HuygensSymplecticAdam` (`huygens_symplectic_adam`)** | `6.1720` | `4.5764` | `479.14` | `97.17` | `19.54%` | `31.27%` | `0.0e+00` | `14.22s` |
| **6** | **`CyclideAdam` (`cyclide_adam`)** | `6.1720` | `4.6722` | `479.14` | `106.93` | `19.54%` | `28.99%` | `0.0e+00` | `13.72s` |
| **7** | **`HuygensAdam` (`huygens_adam`)** | `6.1720` | `4.9113` | `479.14` | `135.81` | `19.54%` | `25.41%` | `0.0e+00` | `13.50s` |
| **8** | **`PairAdam` (`pair_adam`)** | `6.1720` | `5.0931` | `479.14` | `162.89` | `19.54%` | `21.34%` | `0.0e+00` | **`12.96s`** |
### Key Geometric Findings on `GRTRotationalLoRA`
- **`SymplecticAdam` Achieves SOTA on Toroidal LoRA (`53.96` PPL / `35.34%` Token Accuracy)**: Because `lora_B` (`[r, P] = [8, P]`) is initialized to exact zeros (`0.0`) so that `Δθ = 0` at step 0, early gradients on `lora_A` and `lora_B` experience strong singular-value anisotropy across the `r = 8` low-rank bottleneck. `SymplecticAdam`'s Gromov–Liouville reciprocal non-squeezing stiffness floor (`zpe_floor`), Helmholtz–Casimir wave-cavity Laplacian smoothing across stages/ranks, and smooth Cayley rational retraction reduce domain perplexity by **`66.9%` relative to `PairAdam`** (`53.96` vs. `162.89`) and by **`41.0%` relative to `HessianPairAdam`** (`53.96` vs. `91.46`), while boosting token accuracy from `21.34%` (`PairAdam`) and `30.62%` (`HessianPairAdam`) to **`35.34%`**.
- **`GyricAdam` Ranks Strong #2 (`74.58` PPL / `31.76%` Token Accuracy)**: Poinsot polar-conic inertia preconditioning combined with Landé vector-model projection and retrograde Thomas precession damps high-curvature rank oscillations in `lora_A @ lora_B`.
- **`HuygensSymplecticAdam` Ranks #3 in Token Accuracy (`31.27%`)**: Annealing the early Huygens rank-splay perturbation into late-stage symplectic non-squeezing recovers `+5.86%` token accuracy over standalone `HuygensAdam` (`31.27%` vs. `25.41%`).
---
## Quickstart (`transformers`)
### 1. Load & Merge `MatterWaveAI/grt-30m-lora` into `MatterWaveAI/grt-30m`
```python
import torch
from huggingface_hub import snapshot_download
from transformers import AutoTokenizer
from transformers.models.grt import GRTForCausalLM, load_grt_lora_pretrained
base_id = "MatterWaveAI/grt-30m"
adapter_dir = snapshot_download("MatterWaveAI/grt-30m-lora")
tokenizer = AutoTokenizer.from_pretrained(base_id)
model = GRTForCausalLM.from_pretrained(base_id, torch_dtype=torch.float32)
# Attach and fold the toroidal LoRA phase shifts into base_angles (0 inference overhead)
load_grt_lora_pretrained(model, adapter_dir, merge=True)
prompt = "<|im_start|>user\nExplain how GRTRotationalLoRA adapts a Geometric Rotation Transformer without linear layers.<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
out_ids = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(tokenizer.decode(out_ids[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
```
### 2. Train Your Own Toroidal LoRA Adapter
```python
from transformers.models.grt import (
GRTForCausalLM,
attach_grt_lora,
build_grt_optimizer,
merge_grt_lora,
save_grt_lora_pretrained,
)
model = GRTForCausalLM.from_pretrained("MatterWaveAI/grt-30m")
attach_grt_lora(model, r=8, lora_alpha=16.0, tune_scales=True)
optimizer = build_grt_optimizer(model, lr=1e-2, weight_decay=0.0, hessian_mode=True)
# ... training loop ...
save_grt_lora_pretrained(model, "./my-grt-lora")
merge_grt_lora(model) # zero-overhead merged inference
```
---
## Complete `MatterWaveAI/grt-30m*` Research Suite on Hugging Face
1. **Base Causal LM**: [`MatterWaveAI/grt-30m`](https://huggingface.co/MatterWaveAI/grt-30m)
2. **Chat Fine-Tune**: [`MatterWaveAI/grt-30m-chat`](https://huggingface.co/MatterWaveAI/grt-30m-chat)
3. **4-Expert Mixture-of-Rotations (`MoR`)**: [`MatterWaveAI/grt-30m-mor`](https://huggingface.co/MatterWaveAI/grt-30m-mor)
4. **Circular-Pooled Sentence Embedding**: [`MatterWaveAI/grt-30m-embedding`](https://huggingface.co/MatterWaveAI/grt-30m-embedding)
5. **Cross-Encoder Reranker**: [`MatterWaveAI/grt-30m-reranker`](https://huggingface.co/MatterWaveAI/grt-30m-reranker)
6. **Vision-Language (`GRTVL`)**: [`MatterWaveAI/grt-30m-vl`](https://huggingface.co/MatterWaveAI/grt-30m-vl)
7. **Canonical Tokenizer & Polar Embedding Bank**: [`MatterWaveAI/grt-30m-tokenizer`](https://huggingface.co/MatterWaveAI/grt-30m-tokenizer)
8. **Rotational Text-to-Speech (`GRTTTS`)**: [`MatterWaveAI/grt-30m-tts`](https://huggingface.co/MatterWaveAI/grt-30m-tts)
9. **Multimodal Vision-Audio-Language-Speech (`GRTOmni`)**: [`MatterWaveAI/grt-30m-omni`](https://huggingface.co/MatterWaveAI/grt-30m-omni)
10. **Toroidal Rotational LoRA (`GRTRotationalLoRA`)**: [`MatterWaveAI/grt-30m-lora`](https://huggingface.co/MatterWaveAI/grt-30m-lora)
11. **Rotational Speech-to-Text ASR (`GRTASR`)**: [`MatterWaveAI/grt-30m-asr`](https://huggingface.co/MatterWaveAI/grt-30m-asr)
- **Whitepaper**: [**The Geometric Rotation Transformer (GRT): A Purely Rotational Foundation Architecture (`GRT_Whitepaper.pdf`)**](https://huggingface.co/MatterWaveAI/grt-30m/resolve/main/GRT_Whitepaper.pdf)
---
## License
Apache 2.0
---
## Citation
```bibtex
@techreport{householter2026grt,
title = {The Geometric Rotation Transformer: A Purely Rotational Foundation Architecture},
author = {Householter, David},
institution = {MatterWave AI},
year = {2026},
url = {https://matterwave.ai}
}
```
|