davidhouseholter commited on
Commit
28a90b6
·
verified ·
1 Parent(s): 0c8dbfe

Fix math formatting in README.md for Hugging Face Hub

Browse files
Files changed (1) hide show
  1. README.md +60 -5
README.md CHANGED
@@ -4,6 +4,7 @@ library_name: transformers
4
  pipeline_tag: text-generation
5
  tags:
6
  - grt
 
7
  - mixture-of-rotations
8
  - mor
9
  - moe
@@ -18,13 +19,54 @@ base_model: MatterWaveAI/grt-30m
18
 
19
  **GRT-30M-MoR** (`31,634,086` parameters, **zero `nn.Linear` layers**) is the **Mixture-of-Rotations (`MoR`)** upcycled variant of [`MatterWaveAI/grt-30m`](https://huggingface.co/MatterWaveAI/grt-30m) (`29,305,498` parameters).
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  ## Architectural Highlights
22
 
23
- - **4x FFN Rotational Capacity at 1x Rotation Compute**: Each of the 12 `GRTFeedForward` blocks maintains `ffn_n_experts = 4` rotational cascades (`expert_expand_angles [4, 21, 512]`, `expert_expand_scales [4, 21, 1024]`, `expert_contract_angles [4, 21, 512]`, `expert_contract_scales [4, 21, 1024]`). Because 2D Givens rotations form an abelian Lie group $SO(2)^P$ per stage, the router blends the expert angles $\theta_{n,k,p} = \sum_{e=0}^{E-1} w_{n,e} \theta^{(e)}_{k,p}$ and scales $s_{n,k,d} = \sum_{e=0}^{E-1} w_{n,e} \text{softplus}(\tilde{s}^{(e)}_{k,d})$ **before** executing a single Givens rotation $(\cos\theta, \sin\theta)$ per pair.
24
- - **100% Rotational Router (`GRTRotationalRouter`, 0 `nn.Linear` Layers)**: Tokens are routed to experts via cosine phase-angle alignment against $E=4$ learned phase-angle prototypes on the torus $(S^1)^{128}$.
25
- - **Multi-Domain Upcycling & Specialization**:
26
- - **Held-out Perplexity**: `346.10` (initial zero-sum upcycle) $\rightarrow$ **`1.67`** (specialized 4-expert MoR)
27
- - **Held-out Loss**: `5.8467` $\rightarrow$ **`0.5115`**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  ## Quickstart (`transformers`)
30
 
@@ -40,3 +82,16 @@ inputs = tokenizer("The Givens Rotational Transformer replaces dense matrices wi
40
  out_ids = model.generate(**inputs, max_new_tokens=32, do_sample=False)
41
  print(tokenizer.decode(out_ids[0], skip_special_tokens=True))
42
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  pipeline_tag: text-generation
5
  tags:
6
  - grt
7
+ - geometric-rotation-transformer
8
  - mixture-of-rotations
9
  - mor
10
  - moe
 
19
 
20
  **GRT-30M-MoR** (`31,634,086` parameters, **zero `nn.Linear` layers**) is the **Mixture-of-Rotations (`MoR`)** upcycled variant of [`MatterWaveAI/grt-30m`](https://huggingface.co/MatterWaveAI/grt-30m) (`29,305,498` parameters).
21
 
22
+ Instead of routing tokens through multiple separate dense `nn.Linear` feed-forward matrices, **GRT-30M-MoR** exploits the abelian Lie group structure of planar `2×2` Givens rotations (`SO(2)^P` at each butterfly stage): the router blends the `E = 4` expert rotation angles and log-scales in parameter space **before** executing a single `cos / sin` Givens rotation cascade per stage — providing **`4×` FFN rotational capacity at `1×` trigonometric rotation compute**.
23
+
24
+ ---
25
+
26
+ ## Model Details
27
+
28
+ | Property | Value |
29
+ | :--- | :--- |
30
+ | **Architecture** | `GRTForCausalLM` (`model_type: "grt"`, Mixture-of-Rotations) |
31
+ | **Base model** | [`MatterWaveAI/grt-30m`](https://huggingface.co/MatterWaveAI/grt-30m) |
32
+ | **Total stored parameters** | `31,634,086` (`31.63M`, `+2,328,588` over `grt-30m`) |
33
+ | **Non-embedding backbone parameters** | `12,068,785` (`12.07M` across 12 MoR blocks) |
34
+ | **Number of FFN rotational experts (`ffn_n_experts`)** | `4` per block (`48` rotational FFN experts across 12 layers) |
35
+ | **MoR parameterization (`mor_mode`)** | `"direct"` (`expert_expand_angles [4, 21, 512]`, `expert_expand_scales [4, 21, 1024]`, `expert_contract_angles [4, 21, 512]`, `expert_contract_scales [4, 21, 1024]`) |
36
+ | **Router architecture (`mor_router_mode`)** | `"rotational"` (`GRTRotationalRouter` — cosine phase-angle alignment on `(S¹)^128`, **0 `nn.Linear` layers**) |
37
+ | **`nn.Linear` layers** | **`0`** |
38
+ | **`hidden_size` (`d_model`) / `intermediate_size` (`d_ff`)** | `256` / `1,024` |
39
+ | **`num_hidden_layers` / `num_attention_heads`** | `12` / `4` (`head_dim = 64`) |
40
+ | **`n_qkv_rotations` / `n_mixer_rotations` / `ffn_n_rotations`** | `11` / `1` / `21` |
41
+ | **Vocabulary** | `151,669` (Qwen 3 BPE, tied polar cosine head) |
42
+
43
+ ---
44
+
45
  ## Architectural Highlights
46
 
47
+ 1. **4× FFN Rotational Capacity at 1× Rotation Compute (`_mor_rotate`)**:
48
+ Each of the 12 `GRTFeedForward` blocks maintains `ffn_n_experts = 4` rotational cascades. Given per-token router probabilities `w[n, e]` (`sum_e w[n, e] = 1`), the effective rotation angle and positive scale at stage `k`, pair `p` / dimension `d` are blended prior to rotation:
49
+ ```text
50
+ θ_blended[n, k, p] = Σ_{e=0..3} w[n, e] · θ_expert[e, k, p]
51
+ s_blended[n, k, d] = Σ_{e=0..3} w[n, e] · softplus(s_raw_expert[e, k, d])
52
+ ```
53
+ A single Givens rotation `(cos θ_blended, sin θ_blended)` is then applied per pair.
54
+ 2. **100% Rotational Router (`GRTRotationalRouter`, 0 `nn.Linear` Layers)**:
55
+ Tokens are routed to experts via scaled cosine alignment between L2-normalized planar coordinate pairs `(u_p, v_p)` and `E = 4` learned phase-angle prototypes `(cos φ_{e,p}, sin φ_{e,p})` with learned `softplus(output_scale)` temperature.
56
+ 3. **Zero-Sum Walsh–Hadamard Upcycling & Multi-Domain Specialization (`PairAdam`)**:
57
+ Initialized from `MatterWaveAI/grt-30m` via zero-sum Walsh–Hadamard angular perturbations (`Σ_e Δ^(e) = 0`) and specialized on a 4-domain corpus (`rotational_geometry`, `science_and_physics`, `code_and_algorithms`, `reasoning_and_language`) on an Intel Arc 140T XPU (`xpu:0`) with `PairAdam` and Switch-style load balancing:
58
+
59
+ | Metric | Initial Upcycle | After MoR Specialization (`PairAdam`) |
60
+ | :--- | :---: | :---: |
61
+ | **Held-Out Validation Loss** | `5.8467` | **`0.5115`** |
62
+ | **Held-Out Validation Perplexity** | `346.10` | **`1.67`** |
63
+ | **Domain Loss — `code_and_algorithms`** | `5.4092` | **`0.4334`** |
64
+ | **Domain Loss — `rotational_geometry`** | `6.6421` | **`0.4991`** |
65
+ | **Domain Loss — `science_and_physics`** | `5.3337` | **`0.5293`** |
66
+ | **Domain Loss — `reasoning_and_language`** | `6.1720` | **`0.6442`** |
67
+ | **Mean Expert Routing Load (`E = 4`)** | `[0.25, 0.25, 0.25, 0.25]` | **`[0.250, 0.248, 0.256, 0.245]`** (`entropy = 1.386 / 1.386`) |
68
+
69
+ ---
70
 
71
  ## Quickstart (`transformers`)
72
 
 
82
  out_ids = model.generate(**inputs, max_new_tokens=32, do_sample=False)
83
  print(tokenizer.decode(out_ids[0], skip_special_tokens=True))
84
  ```
85
+
86
+ ## Quickstart (`vLLM`)
87
+
88
+ ```python
89
+ from vllm import LLM, SamplingParams
90
+
91
+ llm = LLM(model="MatterWaveAI/grt-30m-mor", model_impl="transformers", dtype="float32")
92
+ outputs = llm.generate(
93
+ ["The Givens Rotational Transformer replaces dense matrices with"],
94
+ SamplingParams(temperature=0.0, max_tokens=32),
95
+ )
96
+ print(outputs[0].outputs[0].text)
97
+ ```