M.A.T.E.R.I.A. V4 (Multi-Analytical Toroidal Engine for Recursive Intelligent Analysis) is a novel neural architecture that departs from the traditional linear transformer paradigm. Instead of processing tokens through a sequential stack, MATERIA employs a toroidal (donut-shaped) geometry where GQA, SNN, and SSM components converge into a unified JEPA latent space through hexagonal interconnection.
The key architectural insight is that information flows in cycles through a toroidal topology, with each cycle inheriting sparse activation patterns from the previous one (70/30 blend). This creates a recurrent processing structure without the computational overhead of traditional recurrence.
HSAQ (HyperSparse Adaptive Quantization) is the core innovation — it replaces AdamW as the model optimizer while simultaneously providing adaptive sparse activation.
Unlike traditional optimizers that maintain complex state (AdamW: 2 states/param, 8 bytes/param), HSAQ uses:
Supplemental: Wikipedia (12 languages: EN, ES, FR, DE, PT, AR, HI, JA, KO, RU, IT, ZH)
Size: ~5M lines, 625,892 training chunks at seq_len=128
Format: BPE-tokenized with SentencePiece multilingual model
📊 Training Results
Final Metrics
Metric
Value
Notes
Total Loss
0.1303
Dual loss: token + K·jepa
Token Loss
~8.06
Cross-entropy
JEPA MSE
~0.052
Normalized by latent variance
Accuracy
6.36%
Token prediction (early training)
Perplexity
~4186
Expected for 2-epoch 1B model
SNN Spike Rate
30.3%
✅ Perfectly calibrated to target
HSAQ Sparsity
0.029 (target 0.048)
Adaptive, undershooting target
NaN Events
0
Stable training throughout
Performance Curves
Metric
Trend
Loss
8.9 → 0.13 (smooth decay)
Accuracy
4.6% → 6.36% (improving)
Perplexity
7,941 → 4,186 (declining)
SNN Spike Rate
46% → 30% (perfectly regulated)
HSAQ Sparsity
0.026 → 0.029 (stable adaptive)
Learning Rate
Linear warmup → cosine decay
Generation Samples (E2 Final)
Prompt
Generation
"The meaning of life is"
constitutional a p juan alum. i spect a recently
"Artificial intelligence"
. a mc. anstuff is the includingporter is youg sch
"Hello, how are you"
group and i for and at the new say and averaged an
Note: Model shows emerging word structure and phrase formation at 2 epochs. Full linguistic capability requires 10+ epochs.
💾 Files
File
Size
Format
Description
materia-v4.basemateria
5.9 GB
Pickle (native)
Full model weights + config + tokenizer
materia-v4.Q4_0.gguf
5.5 GB
GGUF
Q4_0 quantized (llama.cpp/Ollama/LM Studio)
checkpoint_epoch1.pt
11.2 GB
PyTorch
Epoch 1 with optimizer state
checkpoint_epoch2.pt
10.7 GB
PyTorch
Epoch 2 with optimizer state
config_1B.yaml
839 B
YAML
Training configuration
🚀 Usage
PyTorch (Full Precision)
python
1import torch
2import pickle
34# Load .basemateria5withopen('materia-v4.basemateria','rb')as f:6 data = pickle.load(f)78state_dict = data['state_dict']9config = data['config']1011print(f"Model: {data['config']['version']}")12print(f"Dimensions: {config['dim']}, Vocab: {config['vocab_size']}")1314# Import model15from models.materia_v4 import MateriaV4
1617model = MateriaV4(18 vocab_size=config['vocab_size'],19 dim=config['dim'],20 n_layers=24,21 n_heads=24,22 n_kv=6,23 latent_dim=config['latent_dim'],24)25model.load_state_dict(state_dict, strict=False)26model.eval()2728# Generate29import torch.nn.functional as F
30stoi = data['tokenizer']31itos ={v: k for k, v in stoi.items()}3233prompt ="The meaning of life is"34input_ids = torch.tensor([[stoi.get(c,0)for c in prompt]])35with torch.no_grad():36for _ inrange(50):37 logits, _, _ = model(input_ids)38 p = F.softmax(logits[:,-1,:]/0.8, dim=-1)39 next_id = torch.multinomial(p,1)40 input_ids = torch.cat([input_ids, next_id], dim=1)4142output =''.join([itos.get(i.item(),'<unk>')for i in input_ids[0]])43print(output)
llama.cpp / Ollama (GGUF)
bash
1# Verify file integrity2gguf-dump materia-v4.Q4_0.gguf |head -20
34# Run with llama.cpp5./main -m materia-v4.Q4_0.gguf -p "The meaning of life is" -n 50 -t 867# Or with Ollama8ollama create materia-v4 -f Modelfile # Requires custom Modelfile
🧪 MoE Extension
The repository includes a Mixture-of-Experts implementation (8 experts, top-2) for the next generation: