Update README.md
Browse files
README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
| 2 |
license: mit
|
| 3 |
tags:
|
| 4 |
- recursive-reasoning
|
|
|
|
|
|
|
| 5 |
- tiny-model
|
| 6 |
-
- solana
|
| 7 |
-
- blockchain
|
| 8 |
- question-answering
|
| 9 |
- trm
|
| 10 |
-
-
|
| 11 |
-
-
|
| 12 |
datasets:
|
| 13 |
- solana-qa
|
| 14 |
language:
|
|
@@ -20,147 +20,277 @@ library_name: pytorch
|
|
| 20 |
pipeline_tag: text-generation
|
| 21 |
---
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
| 28 |
-
<div align="center">
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
-
[](https://opensource.org/licenses/MIT)
|
| 34 |
-
[](https://pytorch.org/)
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
- π― **Specialized**: Trained specifically on Solana blockchain development
|
| 48 |
-
- π **Well-documented**: Based on peer-reviewed research
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
|
| 52 |
```
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
```
|
| 62 |
|
| 63 |
-
|
| 64 |
|
| 65 |
-
|
| 66 |
|
| 67 |
-
|
| 68 |
-
β
**Educational Tool**: Learning resource for Solana developers
|
| 69 |
-
β
**Code Assistance**: Understanding Solana program architecture and best practices
|
| 70 |
-
β
**Research**: Studying recursive reasoning in small models
|
| 71 |
|
| 72 |
-
###
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
|
| 79 |
-
|
| 80 |
|
| 81 |
-
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
-
|
| 86 |
-
- **Topics**: Solana architecture, smart contracts, transactions, accounts, programs, security
|
| 87 |
-
- **Format**: Instruction-input-output tuples
|
| 88 |
-
- **Encoding**: Byte-level tokenization (UTF-8)
|
| 89 |
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
-
|
| 93 |
-
- **Hardware**: Apple Silicon (M1/M2/M3) with MPS acceleration
|
| 94 |
-
- **Epochs**: 1,000 - 5,000 (varies by run)
|
| 95 |
-
- **Batch Size**: 64 (global batch size)
|
| 96 |
-
- **Learning Rate**: 1e-4
|
| 97 |
-
- **Optimizer**: AdamW (CPU-compatible fallback)
|
| 98 |
-
- **Weight Decay**: 0.5
|
| 99 |
-
- **EMA**: Enabled (rate: 0.999)
|
| 100 |
-
- **Gradient Clipping**: Standard
|
| 101 |
-
- **Training Time**: ~2-4 hours on Apple Silicon
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
Architecture:
|
| 107 |
-
L_layers: 1
|
| 108 |
-
H_cycles: 2
|
| 109 |
-
L_cycles: 2
|
| 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 |
-
| GPT-3 | 175B | Good | Expensive |
|
| 142 |
-
| LLaMA-7B | 7B | Good | GPU required |
|
| 143 |
-
| **TRM-Solana** | **3.5M** | **Specialized** | **CPU/MPS** |
|
| 144 |
|
| 145 |
-
|
| 146 |
|
| 147 |
### Installation
|
| 148 |
|
| 149 |
```bash
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
# Install dependencies
|
| 151 |
-
pip install torch transformers huggingface_hub
|
| 152 |
|
| 153 |
-
#
|
| 154 |
-
|
| 155 |
-
cd TinyRecursiveModels
|
| 156 |
-
pip install -r requirements.txt
|
| 157 |
```
|
| 158 |
|
| 159 |
-
###
|
| 160 |
|
| 161 |
```python
|
| 162 |
-
from huggingface_hub import hf_hub_download
|
| 163 |
import torch
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
# Download checkpoint
|
| 166 |
checkpoint_path = hf_hub_download(
|
|
@@ -168,141 +298,285 @@ checkpoint_path = hf_hub_download(
|
|
| 168 |
filename="model.pt"
|
| 169 |
)
|
| 170 |
|
| 171 |
-
# Load
|
| 172 |
checkpoint = torch.load(checkpoint_path, map_location='cpu')
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
print(f"Model trained for {checkpoint['epoch']} epochs")
|
| 177 |
-
print(f"Training loss: {checkpoint['train_loss']:.4f}")
|
| 178 |
-
print(f"Test loss: {checkpoint['test_loss']:.4f}")
|
| 179 |
-
```
|
| 180 |
-
|
| 181 |
-
### Inference (Requires TRM Code)
|
| 182 |
-
|
| 183 |
-
```python
|
| 184 |
-
# Note: You need the TRM model code from the repository
|
| 185 |
-
from models.recursive_reasoning.trm import TinyRecursiveReasoningModel_ACTV1
|
| 186 |
-
|
| 187 |
-
# Initialize model with config
|
| 188 |
-
model = TinyRecursiveReasoningModel_ACTV1(**config['arch'])
|
| 189 |
-
|
| 190 |
-
# Load weights
|
| 191 |
-
model.load_state_dict(model_state)
|
| 192 |
model.eval()
|
| 193 |
|
| 194 |
-
#
|
| 195 |
-
def
|
| 196 |
bytes_arr = np.frombuffer(text.encode('utf-8'), dtype=np.uint8)
|
| 197 |
-
tokens = (bytes_arr + 2).astype(np.uint8)
|
| 198 |
-
|
| 199 |
-
# Pad sequence
|
| 200 |
seq = np.zeros(max_len, dtype=np.uint8)
|
| 201 |
-
seq[:len(tokens)] = tokens[:max_len-1]
|
| 202 |
-
seq[min(len(tokens), max_len-1)] = 1 # EOS
|
| 203 |
-
|
| 204 |
return torch.tensor(seq).unsqueeze(0)
|
| 205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
# Inference
|
| 207 |
question = "What is a Program Derived Address (PDA) in Solana?"
|
| 208 |
-
input_tensor =
|
| 209 |
|
| 210 |
with torch.no_grad():
|
| 211 |
output = model(input_tensor)
|
| 212 |
-
|
| 213 |
-
|
| 214 |
```
|
| 215 |
|
| 216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
|
| 218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
-
|
| 228 |
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
|
| 231 |
-
|
| 232 |
-
2. **Small Model**: Limited capacity compared to large language models
|
| 233 |
-
3. **Byte-level Encoding**: May struggle with very long responses
|
| 234 |
-
4. **Training Data Cutoff**: Knowledge limited to training data timeframe
|
| 235 |
-
5. **No Real-time Updates**: Does not know about post-training Solana changes
|
| 236 |
|
| 237 |
-
|
| 238 |
|
| 239 |
-
|
| 240 |
-
- **English Only**: Trained exclusively on English Q&A pairs
|
| 241 |
-
- **Developer-focused**: Biased toward technical development questions
|
| 242 |
-
- **Format Bias**: Optimized for Q&A format, not conversation
|
| 243 |
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
-
|
| 247 |
-
|------|------------|
|
| 248 |
-
| Outdated information | Always verify with official Solana docs |
|
| 249 |
-
| Security advice | Never rely solely on model for security audits |
|
| 250 |
-
| Code generation | Review and test all generated code |
|
| 251 |
-
| General blockchain questions | Model specializes in Solana only |
|
| 252 |
|
| 253 |
-
##
|
| 254 |
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
|
| 260 |
-
|
| 261 |
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
}
|
| 274 |
```
|
| 275 |
|
| 276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
|
| 278 |
-
|
| 279 |
-
**Architecture**: Based on TRM by Alexia Jolicoeur-Martineau
|
| 280 |
-
**Dataset**: Custom Solana Q&A corpus
|
| 281 |
|
| 282 |
-
|
| 283 |
|
| 284 |
-
|
| 285 |
-
- π» **Code**: [TinyRecursiveModels GitHub](https://github.com/AlexiaJM/TinyRecursiveModels)
|
| 286 |
-
- π **Solana Docs**: [docs.solana.com](https://docs.solana.com)
|
| 287 |
-
- π€ **Model**: [huggingface.co/ordlibrary/trm-solana-v1](https://huggingface.co/ordlibrary/trm-solana-v1)
|
| 288 |
|
| 289 |
-
|
|
|
|
|
|
|
|
|
|
| 290 |
|
| 291 |
-
|
| 292 |
|
| 293 |
-
##
|
| 294 |
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
|
|
|
|
|
|
|
|
|
| 299 |
|
| 300 |
---
|
| 301 |
|
| 302 |
<div align="center">
|
| 303 |
|
| 304 |
-
|
| 305 |
|
| 306 |
-
|
|
|
|
|
|
|
| 307 |
|
| 308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
tags:
|
| 4 |
- recursive-reasoning
|
| 5 |
+
- solana-os
|
| 6 |
+
- blockchain-ai
|
| 7 |
- tiny-model
|
|
|
|
|
|
|
| 8 |
- question-answering
|
| 9 |
- trm
|
| 10 |
+
- token-gated
|
| 11 |
+
- defi-ai
|
| 12 |
datasets:
|
| 13 |
- solana-qa
|
| 14 |
language:
|
|
|
|
| 20 |
pipeline_tag: text-generation
|
| 21 |
---
|
| 22 |
|
| 23 |
+
<div align="center">
|
| 24 |
|
| 25 |
+
# π§ SOLANA $OS
|
| 26 |
|
| 27 |
+
### The Neural Operating System for Solana
|
|
|
|
| 28 |
|
| 29 |
+
```
|
| 30 |
+
βββββββ ββββββββ
|
| 31 |
+
βββββββββββββββββ
|
| 32 |
+
βββ βββββββββββ
|
| 33 |
+
βββ βββββββββββ
|
| 34 |
+
βββββββββββββββββ
|
| 35 |
+
βββββββ ββββββββ
|
| 36 |
+
```
|
| 37 |
|
| 38 |
+
**Recursive Intelligence β’ Token-Gated Inference β’ Autonomous Agents**
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
[](https://pump.fun/DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump)
|
| 41 |
+
[](https://arxiv.org/abs/2510.04871)
|
| 42 |
+
[](https://opensource.org/licenses/MIT)
|
| 43 |
+
[](https://pytorch.org/)
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
|
| 47 |
+
### π Token Contract Address
|
| 48 |
|
| 49 |
+
```
|
| 50 |
+
DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump
|
| 51 |
+
```
|
| 52 |
|
| 53 |
+
[Buy on Pump.fun](https://pump.fun/DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump) β’ [DexScreener](https://dexscreener.com/solana/DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump) β’ [Birdeye](https://birdeye.so/token/DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump)
|
| 54 |
|
| 55 |
+
</div>
|
| 56 |
+
|
| 57 |
+
---
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
## π What is Solana $OS?
|
| 60 |
+
|
| 61 |
+
**Solana $OS** is a token-gated AI infrastructure layer combining a **3.5M parameter Tiny Recursive Model (TRM)** with blockchain-native utility. It powers intelligent Solana development assistance, autonomous agents, and on-chain AI inference.
|
| 62 |
|
| 63 |
```
|
| 64 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 65 |
+
β SOLANA $OS ECOSYSTEM β
|
| 66 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 67 |
+
β β
|
| 68 |
+
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
|
| 69 |
+
β β $OS TRM βββββΆβ CLAWDBOT βββββΆβ INFERENCE β β
|
| 70 |
+
β β Model β β Agent β β API β β
|
| 71 |
+
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
|
| 72 |
+
β β β β β
|
| 73 |
+
β ββββββββββββββββββββΌβββββββββββββββββββ β
|
| 74 |
+
β βΌ β
|
| 75 |
+
β βββββββββββββββ β
|
| 76 |
+
β β $OS TOKEN β β
|
| 77 |
+
β β UTILITY β β
|
| 78 |
+
β βββββββββββββββ β
|
| 79 |
+
β β
|
| 80 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 81 |
```
|
| 82 |
|
| 83 |
+
---
|
| 84 |
|
| 85 |
+
## π° $OS Token Utility
|
| 86 |
|
| 87 |
+
The **$OS token** unlocks access to the entire Solana OS ecosystem:
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
+
### π« Tier System
|
| 90 |
|
| 91 |
+
| Tier | $OS Holdings | Benefits |
|
| 92 |
+
|------|-------------|----------|
|
| 93 |
+
| π₯ **Bronze** | 10,000 $OS | 100 inference calls/day |
|
| 94 |
+
| π₯ **Silver** | 100,000 $OS | 1,000 inference calls/day + Clawdbot basic |
|
| 95 |
+
| π₯ **Gold** | 500,000 $OS | 5,000 inference calls/day + Clawdbot pro |
|
| 96 |
+
| π **Diamond** | 1,000,000+ $OS | Unlimited + Clawdbot autonomous + API keys |
|
| 97 |
|
| 98 |
+
### π Access Methods
|
| 99 |
|
| 100 |
+
**1. Hold to Access (Recommended)**
|
| 101 |
+
Simply hold $OS tokens in your connected wallet to unlock tier benefits automatically.
|
| 102 |
|
| 103 |
+
**2. Burn for Credits**
|
| 104 |
+
Burn $OS tokens to receive permanent inference credits:
|
| 105 |
+
- 1,000 $OS burned = 500 inference credits (never expire)
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
+
**3. Stake for Premium**
|
| 108 |
+
Stake $OS to earn yield while maintaining access:
|
| 109 |
+
- Staked tokens count toward tier qualification
|
| 110 |
+
- Earn additional $OS from protocol fees
|
| 111 |
|
| 112 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
+
## π€ Clawdbot Integration
|
| 115 |
+
|
| 116 |
+
**Clawdbot** is an autonomous AI agent powered by Solana $OS, capable of:
|
| 117 |
+
|
| 118 |
+
```typescript
|
| 119 |
+
// Clawdbot Capabilities
|
| 120 |
+
interface ClawdbotFeatures {
|
| 121 |
+
// Solana Development
|
| 122 |
+
codeAnalysis: "Smart contract review & optimization";
|
| 123 |
+
pdaGeneration: "Generate PDAs with derivation paths";
|
| 124 |
+
txBuilder: "Construct & simulate transactions";
|
| 125 |
+
|
| 126 |
+
// Autonomous Actions
|
| 127 |
+
portfolioMonitor: "Track & alert on positions";
|
| 128 |
+
dexAggregation: "Find optimal swap routes";
|
| 129 |
+
yieldFarming: "Auto-compound strategies";
|
| 130 |
+
|
| 131 |
+
// Intelligence
|
| 132 |
+
marketAnalysis: "Real-time sentiment & signals";
|
| 133 |
+
contractAudit: "Security vulnerability detection";
|
| 134 |
+
documentation: "Auto-generate project docs";
|
| 135 |
+
}
|
| 136 |
+
```
|
| 137 |
|
| 138 |
+
### Clawdbot Access Tiers
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
+
| Feature | Silver | Gold | Diamond |
|
| 141 |
+
|---------|--------|------|---------|
|
| 142 |
+
| Q&A Responses | β
| β
| β
|
|
| 143 |
+
| Code Analysis | β
| β
| β
|
|
| 144 |
+
| Transaction Building | β | β
| β
|
|
| 145 |
+
| Autonomous Monitoring | β | β | β
|
|
| 146 |
+
| Custom Agent Training | β | β | β
|
|
| 147 |
+
| API Access | β | β | β
|
|
| 148 |
|
| 149 |
+
---
|
| 150 |
+
|
| 151 |
+
## π§ Model Architecture
|
| 152 |
+
|
| 153 |
+
Solana $OS is built on the **Tiny Recursive Model (TRM)** architecture:
|
| 154 |
+
|
| 155 |
+
```
|
| 156 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 157 |
+
β TRM-SOLANA-OS ARCHITECTURE β
|
| 158 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 159 |
+
β β
|
| 160 |
+
β Input: "What is a PDA?" β
|
| 161 |
+
β β β
|
| 162 |
+
β βΌ β
|
| 163 |
+
β βββββββββββββββββββοΏ½οΏ½βββββββββββββββββββββββββββββββ β
|
| 164 |
+
β β BYTE-LEVEL TOKENIZATION β β
|
| 165 |
+
β β (UTF-8 β 258 vocab tokens) β β
|
| 166 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 167 |
+
β β β
|
| 168 |
+
β βΌ β
|
| 169 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 170 |
+
β β RECURSIVE REASONING CORE β β
|
| 171 |
+
β β βββββββββββββββββββββββββββββββββββββββββββ β β
|
| 172 |
+
β β β H-Cycle 1 βββΆ H-Cycle 2 β β β
|
| 173 |
+
β β β β β β β β
|
| 174 |
+
β β β βΌ βΌ β β β
|
| 175 |
+
β β β L-Cycle 1,2 L-Cycle 1,2 β β β
|
| 176 |
+
β β βββββββββββββββββββββββββββββββββββββββββββ β β
|
| 177 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 178 |
+
β β β
|
| 179 |
+
β βΌ β
|
| 180 |
+
β Output: Refined Solana expertise β
|
| 181 |
+
β β
|
| 182 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
### Specifications
|
| 186 |
+
|
| 187 |
+
| Component | Value |
|
| 188 |
+
|-----------|-------|
|
| 189 |
+
| **Parameters** | 3.5M (~1/1000th of GPT-3) |
|
| 190 |
+
| **Layers (L)** | 1 transformer layer |
|
| 191 |
+
| **High-level cycles (H)** | 2 reasoning iterations |
|
| 192 |
+
| **Low-level cycles (L)** | 2 refinement iterations |
|
| 193 |
+
| **Vocabulary** | 258 tokens (byte-level) |
|
| 194 |
+
| **Max Sequence** | 512 tokens |
|
| 195 |
+
| **Inference** | CPU/MPS/GPU compatible |
|
| 196 |
+
| **Memory** | <1GB during inference |
|
| 197 |
+
|
| 198 |
+
---
|
| 199 |
+
|
| 200 |
+
## π Quick Start
|
| 201 |
+
|
| 202 |
+
### 1. Connect Wallet & Verify Holdings
|
| 203 |
+
|
| 204 |
+
```typescript
|
| 205 |
+
import { Connection, PublicKey } from '@solana/web3.js';
|
| 206 |
+
import { getAssociatedTokenAddress, getAccount } from '@solana/spl-token';
|
| 207 |
+
|
| 208 |
+
const OS_TOKEN_MINT = new PublicKey('DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump');
|
| 209 |
+
|
| 210 |
+
async function checkOSBalance(walletPubkey: PublicKey): Promise<number> {
|
| 211 |
+
const connection = new Connection('https://api.mainnet-beta.solana.com');
|
| 212 |
+
|
| 213 |
+
const ata = await getAssociatedTokenAddress(OS_TOKEN_MINT, walletPubkey);
|
| 214 |
+
|
| 215 |
+
try {
|
| 216 |
+
const account = await getAccount(connection, ata);
|
| 217 |
+
return Number(account.amount) / 1e6; // Assuming 6 decimals
|
| 218 |
+
} catch {
|
| 219 |
+
return 0;
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
function getTier(balance: number): string {
|
| 224 |
+
if (balance >= 1_000_000) return 'diamond';
|
| 225 |
+
if (balance >= 500_000) return 'gold';
|
| 226 |
+
if (balance >= 100_000) return 'silver';
|
| 227 |
+
if (balance >= 10_000) return 'bronze';
|
| 228 |
+
return 'none';
|
| 229 |
+
}
|
| 230 |
```
|
| 231 |
|
| 232 |
+
### 2. API Inference
|
| 233 |
+
|
| 234 |
+
```typescript
|
| 235 |
+
// Token-gated inference endpoint
|
| 236 |
+
const response = await fetch('https://api.solana-os.ai/v1/inference', {
|
| 237 |
+
method: 'POST',
|
| 238 |
+
headers: {
|
| 239 |
+
'Content-Type': 'application/json',
|
| 240 |
+
'X-Wallet-Address': walletAddress,
|
| 241 |
+
'X-Signature': signedMessage, // Prove wallet ownership
|
| 242 |
+
},
|
| 243 |
+
body: JSON.stringify({
|
| 244 |
+
question: 'How do I create a PDA in Anchor?',
|
| 245 |
+
model: 'trm-solana-os-v1',
|
| 246 |
+
max_tokens: 512,
|
| 247 |
+
}),
|
| 248 |
+
});
|
| 249 |
+
|
| 250 |
+
const { answer, tokens_used, remaining_calls } = await response.json();
|
| 251 |
+
```
|
| 252 |
|
| 253 |
+
### 3. Clawdbot Discord/Telegram
|
| 254 |
|
| 255 |
+
```
|
| 256 |
+
# Discord Commands (Silver+ tier)
|
| 257 |
+
/clawdbot ask "What is rent exemption in Solana?"
|
| 258 |
+
/clawdbot analyze <contract_address>
|
| 259 |
+
/clawdbot build-tx transfer 1 SOL to <address>
|
| 260 |
+
|
| 261 |
+
# Telegram Commands
|
| 262 |
+
/ask What are CPIs?
|
| 263 |
+
/audit <program_id>
|
| 264 |
+
/monitor <token_address>
|
| 265 |
+
```
|
| 266 |
|
| 267 |
+
---
|
| 268 |
|
| 269 |
+
## π§ Self-Hosted Inference
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
+
For Diamond tier holders, run the model locally:
|
| 272 |
|
| 273 |
### Installation
|
| 274 |
|
| 275 |
```bash
|
| 276 |
+
# Clone the repository
|
| 277 |
+
git clone https://github.com/8bitlabs/solana-os-model
|
| 278 |
+
cd solana-os-model
|
| 279 |
+
|
| 280 |
# Install dependencies
|
| 281 |
+
pip install torch transformers huggingface_hub numpy
|
| 282 |
|
| 283 |
+
# Download model
|
| 284 |
+
python scripts/download_model.py --token YOUR_HF_TOKEN
|
|
|
|
|
|
|
| 285 |
```
|
| 286 |
|
| 287 |
+
### Local Inference
|
| 288 |
|
| 289 |
```python
|
|
|
|
| 290 |
import torch
|
| 291 |
+
import numpy as np
|
| 292 |
+
from huggingface_hub import hf_hub_download
|
| 293 |
+
from models.trm import TinyRecursiveReasoningModel
|
| 294 |
|
| 295 |
# Download checkpoint
|
| 296 |
checkpoint_path = hf_hub_download(
|
|
|
|
| 298 |
filename="model.pt"
|
| 299 |
)
|
| 300 |
|
| 301 |
+
# Load model
|
| 302 |
checkpoint = torch.load(checkpoint_path, map_location='cpu')
|
| 303 |
+
model = TinyRecursiveReasoningModel(**checkpoint['config']['arch'])
|
| 304 |
+
model.load_state_dict(checkpoint['model_state_dict'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
model.eval()
|
| 306 |
|
| 307 |
+
# Byte-level encoding
|
| 308 |
+
def encode(text: str, max_len: int = 512) -> torch.Tensor:
|
| 309 |
bytes_arr = np.frombuffer(text.encode('utf-8'), dtype=np.uint8)
|
| 310 |
+
tokens = (bytes_arr + 2).astype(np.uint8)
|
|
|
|
|
|
|
| 311 |
seq = np.zeros(max_len, dtype=np.uint8)
|
| 312 |
+
seq[:min(len(tokens), max_len-1)] = tokens[:max_len-1]
|
| 313 |
+
seq[min(len(tokens), max_len-1)] = 1 # EOS
|
|
|
|
| 314 |
return torch.tensor(seq).unsqueeze(0)
|
| 315 |
|
| 316 |
+
def decode(tokens: torch.Tensor) -> str:
|
| 317 |
+
tokens = tokens.squeeze().numpy()
|
| 318 |
+
tokens = tokens[tokens > 1] - 2 # Remove PAD/EOS, unshift
|
| 319 |
+
return bytes(tokens).decode('utf-8', errors='replace')
|
| 320 |
+
|
| 321 |
# Inference
|
| 322 |
question = "What is a Program Derived Address (PDA) in Solana?"
|
| 323 |
+
input_tensor = encode(question)
|
| 324 |
|
| 325 |
with torch.no_grad():
|
| 326 |
output = model(input_tensor)
|
| 327 |
+
answer = decode(output.argmax(dim=-1))
|
| 328 |
+
print(answer)
|
| 329 |
```
|
| 330 |
|
| 331 |
+
---
|
| 332 |
+
|
| 333 |
+
## π Training Details
|
| 334 |
+
|
| 335 |
+
### Dataset
|
| 336 |
|
| 337 |
+
| Metric | Value |
|
| 338 |
+
|--------|-------|
|
| 339 |
+
| **Total Pairs** | 8,970 Q&A |
|
| 340 |
+
| **Training Set** | 8,073 (90%) |
|
| 341 |
+
| **Test Set** | 897 (10%) |
|
| 342 |
+
| **Topics** | Solana architecture, accounts, programs, transactions, security, DeFi |
|
| 343 |
+
| **Encoding** | Byte-level UTF-8 |
|
| 344 |
|
| 345 |
+
### Training Configuration
|
| 346 |
+
|
| 347 |
+
```yaml
|
| 348 |
+
# config/training.yaml
|
| 349 |
+
architecture:
|
| 350 |
+
L_layers: 1
|
| 351 |
+
H_cycles: 2
|
| 352 |
+
L_cycles: 2
|
| 353 |
+
vocab_size: 258
|
| 354 |
+
max_seq_len: 512
|
| 355 |
+
|
| 356 |
+
training:
|
| 357 |
+
epochs: 5000
|
| 358 |
+
global_batch_size: 64
|
| 359 |
+
learning_rate: 1e-4
|
| 360 |
+
weight_decay: 0.5
|
| 361 |
+
ema_enabled: true
|
| 362 |
+
ema_rate: 0.999
|
| 363 |
+
|
| 364 |
+
hardware:
|
| 365 |
+
device: mps # Apple Silicon
|
| 366 |
+
training_time: "~4 hours"
|
| 367 |
+
```
|
| 368 |
|
| 369 |
+
### Performance
|
| 370 |
|
| 371 |
+
| Metric | Value |
|
| 372 |
+
|--------|-------|
|
| 373 |
+
| Training Loss | ~2.3 |
|
| 374 |
+
| Test Loss | ~2.5 |
|
| 375 |
+
| Inference Speed | <100ms |
|
| 376 |
+
| Memory Usage | <1GB |
|
| 377 |
|
| 378 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
|
| 380 |
+
## π― Example Queries
|
| 381 |
|
| 382 |
+
The Solana $OS model excels at:
|
|
|
|
|
|
|
|
|
|
| 383 |
|
| 384 |
+
```
|
| 385 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 386 |
+
β EXAMPLE QUERIES β
|
| 387 |
+
βββββββββββββββββββββββββββββββββββββββββββββββοΏ½οΏ½ββββββββββ€
|
| 388 |
+
β β
|
| 389 |
+
β β "What is a Program Derived Address (PDA)?" β
|
| 390 |
+
β β "How do Solana transactions differ from Ethereum?" β
|
| 391 |
+
β β "Explain the Solana account model" β
|
| 392 |
+
β β "What is rent exemption?" β
|
| 393 |
+
β β "How do cross-program invocations (CPI) work?" β
|
| 394 |
+
β β "What is the System Program?" β
|
| 395 |
+
β β "How does Anchor simplify Solana development?" β
|
| 396 |
+
β β "What are the security best practices for PDAs?" β
|
| 397 |
+
β β
|
| 398 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 399 |
+
```
|
| 400 |
|
| 401 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
|
| 403 |
+
## π‘οΈ Tokenomics
|
| 404 |
|
| 405 |
+
```
|
| 406 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 407 |
+
β $OS TOKENOMICS β
|
| 408 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 409 |
+
β β
|
| 410 |
+
β Token: $OS β
|
| 411 |
+
β Contract: DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump β
|
| 412 |
+
β Chain: Solana β
|
| 413 |
+
β Standard: SPL Token β
|
| 414 |
+
β β
|
| 415 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 416 |
+
β β UTILITY FLYWHEEL β β
|
| 417 |
+
β β β β
|
| 418 |
+
β β ββββββββββββ β β
|
| 419 |
+
β β β HOLD ββββββββββββββββββββ β β
|
| 420 |
+
β β β $OS β β β β
|
| 421 |
+
β β ββββββ¬ββββββ β β β
|
| 422 |
+
β β β β β β
|
| 423 |
+
β β βΌ β β β
|
| 424 |
+
β β ββββββββββββ βββββββ΄βββββ β β
|
| 425 |
+
β β β ACCESS β β VALUE β β β
|
| 426 |
+
β β β TIERS β β ACCRUAL β β β
|
| 427 |
+
β β ββββββ¬ββββββ ββββββββββββ β β
|
| 428 |
+
β β β β² β β
|
| 429 |
+
β β βΌ β β β
|
| 430 |
+
β β ββββββββββββ βββββββ΄βββββ β β
|
| 431 |
+
β β β USE βββββββββββββΆβ DEMAND β β β
|
| 432 |
+
β β β SERVICESβ β GROWS β β β
|
| 433 |
+
β β ββββββββββββ ββββββββββββ β β
|
| 434 |
+
β β β β
|
| 435 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 436 |
+
β β
|
| 437 |
+
β Revenue Streams: β
|
| 438 |
+
β β’ Inference API fees β 50% to stakers β
|
| 439 |
+
β β’ Clawdbot premium features β 30% buyback & burn β
|
| 440 |
+
β β’ Enterprise licensing β Treasury β
|
| 441 |
+
β β
|
| 442 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 443 |
+
```
|
| 444 |
|
| 445 |
+
---
|
| 446 |
|
| 447 |
+
## π Integration Examples
|
| 448 |
+
|
| 449 |
+
### Next.js App Router
|
| 450 |
+
|
| 451 |
+
```typescript
|
| 452 |
+
// app/api/inference/route.ts
|
| 453 |
+
import { NextRequest, NextResponse } from 'next/server';
|
| 454 |
+
import { verifyWalletSignature, checkTier } from '@/lib/auth';
|
| 455 |
+
|
| 456 |
+
export async function POST(req: NextRequest) {
|
| 457 |
+
const { question, walletAddress, signature } = await req.json();
|
| 458 |
+
|
| 459 |
+
// Verify wallet ownership
|
| 460 |
+
const isValid = await verifyWalletSignature(walletAddress, signature);
|
| 461 |
+
if (!isValid) {
|
| 462 |
+
return NextResponse.json({ error: 'Invalid signature' }, { status: 401 });
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
// Check $OS holdings
|
| 466 |
+
const tier = await checkTier(walletAddress);
|
| 467 |
+
if (tier === 'none') {
|
| 468 |
+
return NextResponse.json({
|
| 469 |
+
error: 'Insufficient $OS holdings',
|
| 470 |
+
required: 10000,
|
| 471 |
+
contract: 'DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump'
|
| 472 |
+
}, { status: 403 });
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
// Process inference
|
| 476 |
+
const answer = await runInference(question);
|
| 477 |
+
|
| 478 |
+
return NextResponse.json({ answer, tier });
|
| 479 |
+
}
|
| 480 |
+
```
|
| 481 |
|
| 482 |
+
### React Hook
|
| 483 |
+
|
| 484 |
+
```typescript
|
| 485 |
+
// hooks/useSolanaOS.ts
|
| 486 |
+
import { useWallet } from '@solana/wallet-adapter-react';
|
| 487 |
+
import { useState } from 'react';
|
| 488 |
+
|
| 489 |
+
export function useSolanaOS() {
|
| 490 |
+
const { publicKey, signMessage } = useWallet();
|
| 491 |
+
const [loading, setLoading] = useState(false);
|
| 492 |
+
|
| 493 |
+
const askQuestion = async (question: string) => {
|
| 494 |
+
if (!publicKey || !signMessage) {
|
| 495 |
+
throw new Error('Wallet not connected');
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
setLoading(true);
|
| 499 |
+
|
| 500 |
+
try {
|
| 501 |
+
// Sign message to prove ownership
|
| 502 |
+
const message = new TextEncoder().encode(`Solana OS: ${Date.now()}`);
|
| 503 |
+
const signature = await signMessage(message);
|
| 504 |
+
|
| 505 |
+
const response = await fetch('/api/inference', {
|
| 506 |
+
method: 'POST',
|
| 507 |
+
headers: { 'Content-Type': 'application/json' },
|
| 508 |
+
body: JSON.stringify({
|
| 509 |
+
question,
|
| 510 |
+
walletAddress: publicKey.toBase58(),
|
| 511 |
+
signature: Buffer.from(signature).toString('base64'),
|
| 512 |
+
}),
|
| 513 |
+
});
|
| 514 |
+
|
| 515 |
+
return await response.json();
|
| 516 |
+
} finally {
|
| 517 |
+
setLoading(false);
|
| 518 |
+
}
|
| 519 |
+
};
|
| 520 |
+
|
| 521 |
+
return { askQuestion, loading };
|
| 522 |
}
|
| 523 |
```
|
| 524 |
|
| 525 |
+
---
|
| 526 |
+
|
| 527 |
+
## β οΈ Limitations
|
| 528 |
+
|
| 529 |
+
| Limitation | Description |
|
| 530 |
+
|------------|-------------|
|
| 531 |
+
| **Domain Specific** | Trained only on Solana content |
|
| 532 |
+
| **Knowledge Cutoff** | Limited to training data timeframe |
|
| 533 |
+
| **Not for Audits** | Do not use for production security audits |
|
| 534 |
+
| **English Only** | Trained exclusively on English data |
|
| 535 |
+
| **Q&A Format** | Optimized for questions, not conversations |
|
| 536 |
+
|
| 537 |
+
---
|
| 538 |
+
|
| 539 |
+
## π License
|
| 540 |
|
| 541 |
+
MIT License - Open source and free to use.
|
|
|
|
|
|
|
| 542 |
|
| 543 |
+
---
|
| 544 |
|
| 545 |
+
## π Acknowledgments
|
|
|
|
|
|
|
|
|
|
| 546 |
|
| 547 |
+
- **Alexia Jolicoeur-Martineau** - TRM Architecture
|
| 548 |
+
- **Solana Foundation** - Documentation & Ecosystem
|
| 549 |
+
- **OrdLibrary** - Original model training
|
| 550 |
+
- **8bit Labs** - $OS Token Integration
|
| 551 |
|
| 552 |
+
---
|
| 553 |
|
| 554 |
+
## π Resources
|
| 555 |
|
| 556 |
+
| Resource | Link |
|
| 557 |
+
|----------|------|
|
| 558 |
+
| π TRM Paper | [arXiv:2510.04871](https://arxiv.org/abs/2510.04871) |
|
| 559 |
+
| π» TRM Code | [GitHub](https://github.com/AlexiaJM/TinyRecursiveModels) |
|
| 560 |
+
| π€ Model | [HuggingFace](https://huggingface.co/ordlibrary/trm-solana-v1) |
|
| 561 |
+
| π Solana Docs | [docs.solana.com](https://docs.solana.com) |
|
| 562 |
+
| π Buy $OS | [Pump.fun](https://pump.fun/DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump) |
|
| 563 |
|
| 564 |
---
|
| 565 |
|
| 566 |
<div align="center">
|
| 567 |
|
| 568 |
+
## π Get $OS Now
|
| 569 |
|
| 570 |
+
```
|
| 571 |
+
DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump
|
| 572 |
+
```
|
| 573 |
|
| 574 |
+
**[Pump.fun](https://pump.fun/DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump)** β’ **[DexScreener](https://dexscreener.com/solana/DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump)** β’ **[Birdeye](https://birdeye.so/token/DrU9M6SUaXWua49zeaHQWJuwMpcZ4jMDRT3J5Ywpump)**
|
| 575 |
+
|
| 576 |
+
---
|
| 577 |
+
|
| 578 |
+
**Built by [8bit Labs](https://8bitlabs.ai) for the Solana ecosystem**
|
| 579 |
+
|
| 580 |
+
*The Neural Operating System for Solana*
|
| 581 |
+
|
| 582 |
+
</div>
|