Text Generation
PyTorch
English
MultiXiPARFLM
research
semsimula
conservative-language-model
scalar-potential
lagrangian-mechanics
energy-based-model
physics-informed
parflm
parf
multi-channel-xi
sparse-routing
tinystories
non-transformer
attention-free
constant-memory-inference
riemannian-geometry
riemannian-geodesics
damped-riemannian-geometry
Eval Results (legacy)
Initial model card and config for semsimula-parflm-multixi
Browse files- README.md +259 -0
- config.json +28 -0
README.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: text-generation
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
license: cc-by-4.0
|
| 7 |
+
tags:
|
| 8 |
+
- research
|
| 9 |
+
- semsimula
|
| 10 |
+
- conservative-language-model
|
| 11 |
+
- scalar-potential
|
| 12 |
+
- lagrangian-mechanics
|
| 13 |
+
- energy-based-model
|
| 14 |
+
- physics-informed
|
| 15 |
+
- parflm
|
| 16 |
+
- parf
|
| 17 |
+
- multi-channel-xi
|
| 18 |
+
- sparse-routing
|
| 19 |
+
- tinystories
|
| 20 |
+
datasets:
|
| 21 |
+
- roneneldan/TinyStories
|
| 22 |
+
metrics:
|
| 23 |
+
- perplexity
|
| 24 |
+
model-index:
|
| 25 |
+
- name: semsimula-parflm-multixi
|
| 26 |
+
results:
|
| 27 |
+
- task:
|
| 28 |
+
type: text-generation
|
| 29 |
+
dataset:
|
| 30 |
+
type: roneneldan/TinyStories
|
| 31 |
+
name: TinyStories
|
| 32 |
+
split: validation
|
| 33 |
+
metrics:
|
| 34 |
+
- type: perplexity
|
| 35 |
+
value: 12.06
|
| 36 |
+
name: Validation Perplexity
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
# Multi-Xi PARFLM (Property-Attractive-Repulsive Force Language Model)
|
| 40 |
+
|
| 41 |
+
The **Multi-Xi PARFLM** extends the SPLM with **pairwise token interaction forces** derived from a second scalar potential V_phi. While the base SPLM's V_theta provides a single-body potential (each token interacts only with a summary of its past), PARFLM adds explicit pairwise forces V_phi(h_t, h_s) between tokens -- the physics-informed analogue of attention's pairwise dot-product, but derived from a gradient of a scalar potential (making it conservative).
|
| 42 |
+
|
| 43 |
+
The pairwise forces use **Gumbel-softmax top-k sparse routing** to keep the cost at O(T*k) rather than O(T^2). This model achieves **12.06 PPL** on TinyStories, a 2.6 PPL improvement over the standalone Multi-Xi SPLM.
|
| 44 |
+
|
| 45 |
+
Part of the [Semantic Simulation](https://doi.org/10.5281/zenodo.20579593) framework.
|
| 46 |
+
|
| 47 |
+
## Table of Contents
|
| 48 |
+
|
| 49 |
+
- [Model Details](#model-details)
|
| 50 |
+
- [Architecture](#architecture)
|
| 51 |
+
- [How to Get Started](#how-to-get-started)
|
| 52 |
+
- [Training Details](#training-details)
|
| 53 |
+
- [Evaluation Results](#evaluation-results)
|
| 54 |
+
- [SPLM Family Overview](#splm-family-overview)
|
| 55 |
+
- [Bias, Risks, and Limitations](#bias-risks-and-limitations)
|
| 56 |
+
- [Citation](#citation)
|
| 57 |
+
- [Environmental Impact](#environmental-impact)
|
| 58 |
+
|
| 59 |
+
## Model Details
|
| 60 |
+
|
| 61 |
+
### Model Description
|
| 62 |
+
|
| 63 |
+
The Multi-Xi PARFLM combines two SPLM extensions:
|
| 64 |
+
|
| 65 |
+
1. **Multi-channel K-EMA xi** (from the Multi-Xi SPLM): K=8 learnable causal exponential moving averages giving V_theta a multi-resolution summary of the past.
|
| 66 |
+
2. **Sparse PARF pair-interactions:** A second scalar potential V_phi(h_t, h_s) adds particle-exchange forces between token pairs, routed via Gumbel-softmax top-k selection.
|
| 67 |
+
|
| 68 |
+
The total potential energy for token t is:
|
| 69 |
+
|
| 70 |
+
U_t = V_theta(xi_t, h_t) + sum_{s<t} m_ts * V_phi(h_t, h_s)
|
| 71 |
+
|
| 72 |
+
and the conservative force is f_t = -grad_{h_t} U_t.
|
| 73 |
+
|
| 74 |
+
- **Developed by:** Dimitar P. Gueorguiev (Independent Researcher)
|
| 75 |
+
- **Model type:** Conservative autoregressive language model with pairwise forces
|
| 76 |
+
- **Language:** English
|
| 77 |
+
- **License:** [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/)
|
| 78 |
+
|
| 79 |
+
### Model Sources
|
| 80 |
+
|
| 81 |
+
- **Paper:** [Semantic Simulation: A Prescriptive Lagrangian Framework for Efficient Semantic Inference](https://doi.org/10.5281/zenodo.20579593)
|
| 82 |
+
- **Repository:** [github.com/dimitarpg13/semsimula-paper](https://github.com/dimitarpg13/semsimula-paper)
|
| 83 |
+
- **Model source code:** [`notebooks/conservative_arch/parf/model_parf_multixi.py`](https://github.com/dimitarpg13/semsimula-paper/blob/main/notebooks/conservative_arch/parf/model_parf_multixi.py)
|
| 84 |
+
|
| 85 |
+
## Architecture
|
| 86 |
+
|
| 87 |
+
```
|
| 88 |
+
Input tokens x_1, ..., x_T
|
| 89 |
+
|
|
| 90 |
+
Embedding E[x] + positional encoding
|
| 91 |
+
|
|
| 92 |
+
For each of L=8 integration steps:
|
| 93 |
+
|
|
| 94 |
+
+-- K-EMA channels: xi^(k)_t = causal_ema(h, alpha_k) [K=8 channels]
|
| 95 |
+
|
|
| 96 |
+
+-- Single-body: V_theta([xi_1..xi_K, h]) -> R [3-layer MLP]
|
| 97 |
+
|
|
| 98 |
+
+-- Pair routing: score_head(h_t, h_s) -> top-k selection [Gumbel-softmax]
|
| 99 |
+
|
|
| 100 |
+
+-- Pair forces: V_phi(h_t, h_s) -> R [structural competitive]
|
| 101 |
+
|
|
| 102 |
+
+-- Total: U_t = V_theta + sum V_phi
|
| 103 |
+
|
|
| 104 |
+
+-- Conservative force: f = -grad_h U_t [autograd]
|
| 105 |
+
|
|
| 106 |
+
+-- Damped Euler step: v += dt*f/m; v /= (1 + dt*gamma); h += dt*v
|
| 107 |
+
|
|
| 108 |
+
+-- LayerNorm(h)
|
| 109 |
+
|
|
| 110 |
+
Logits = h @ E^T [tied embeddings]
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
| Parameter | Value |
|
| 114 |
+
|---|---|
|
| 115 |
+
| Hidden dim (d) | 256 |
|
| 116 |
+
| Layers (L) | 8 |
|
| 117 |
+
| V_theta hidden / depth | 1024 / 3 |
|
| 118 |
+
| Xi channels (K) | 8 |
|
| 119 |
+
| Alpha init | log-spaced |
|
| 120 |
+
| V_phi kind | structural_competitive |
|
| 121 |
+
| V_phi hidden (H) | 128 |
|
| 122 |
+
| Sparse routing top_k | 8 |
|
| 123 |
+
| Gumbel tau | 1.0 -> 0.1 (annealed) |
|
| 124 |
+
| Mass model | logfreq (frozen surprisal lookup) |
|
| 125 |
+
| Damping (gamma) | 0.30 (fixed) |
|
| 126 |
+
| Total parameters | **17,632,215** |
|
| 127 |
+
|
| 128 |
+
### Key Design Properties
|
| 129 |
+
|
| 130 |
+
- **Globally conservative:** Both V_theta and V_phi are scalar potentials; the total force f = -grad(V_theta + sum V_phi) is conservative by construction.
|
| 131 |
+
- **Sparse routing:** Gumbel-softmax top-k selection keeps pairwise cost at O(T*k) instead of O(T^2).
|
| 132 |
+
- **Stage-1.5b gathered V_phi:** Memory-efficient implementation replacing O(T^2) intermediates with O(T*k).
|
| 133 |
+
- **Inheritance chain:** MultiXiPARFLM -> SparsePARFLM -> PARFLM (all conservative).
|
| 134 |
+
|
| 135 |
+
## How to Get Started
|
| 136 |
+
|
| 137 |
+
```python
|
| 138 |
+
# Clone the companion repository for full source code
|
| 139 |
+
# git clone https://github.com/dimitarpg13/semsimula-paper.git
|
| 140 |
+
# cd semsimula-paper/notebooks/conservative_arch
|
| 141 |
+
|
| 142 |
+
import torch
|
| 143 |
+
import sys
|
| 144 |
+
sys.path.insert(0, "parf")
|
| 145 |
+
sys.path.insert(0, "multixi")
|
| 146 |
+
sys.path.insert(0, "energetic_minima")
|
| 147 |
+
sys.path.insert(0, "sarf_mass_variant")
|
| 148 |
+
|
| 149 |
+
from parf.model_parf_multixi import MultiXiPARFLM, MultiXiPARFConfig
|
| 150 |
+
|
| 151 |
+
config = MultiXiPARFConfig(
|
| 152 |
+
vocab_size=50257,
|
| 153 |
+
d=256,
|
| 154 |
+
n_layers=8,
|
| 155 |
+
v_hidden=1024,
|
| 156 |
+
v_depth=3,
|
| 157 |
+
max_len=1024,
|
| 158 |
+
block_size=512,
|
| 159 |
+
gamma=0.30,
|
| 160 |
+
xi_channels=8,
|
| 161 |
+
xi_alpha_inits="log_spaced",
|
| 162 |
+
v_phi_kind="structural_competitive",
|
| 163 |
+
v_phi_hidden=128,
|
| 164 |
+
top_k=8,
|
| 165 |
+
)
|
| 166 |
+
|
| 167 |
+
model = MultiXiPARFLM(config)
|
| 168 |
+
print(f"Parameters: {sum(p.numel() for p in model.parameters()):,}")
|
| 169 |
+
|
| 170 |
+
# Forward pass
|
| 171 |
+
x = torch.randint(0, 50257, (1, 64))
|
| 172 |
+
logits, loss = model(x, targets=x)
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
## Training Details
|
| 176 |
+
|
| 177 |
+
### Training Data
|
| 178 |
+
|
| 179 |
+
[TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories) -- GPT-2 BPE tokenization. Training cap: 5M tokens.
|
| 180 |
+
|
| 181 |
+
### Training Procedure
|
| 182 |
+
|
| 183 |
+
| Hyperparameter | Value |
|
| 184 |
+
|---|---|
|
| 185 |
+
| Optimizer | AdamW |
|
| 186 |
+
| Learning rate | 5e-4 (cosine decay) |
|
| 187 |
+
| Warmup steps | 400 |
|
| 188 |
+
| Weight decay | 0.01 |
|
| 189 |
+
| Gradient clipping | 1.0 |
|
| 190 |
+
| Batch size | 16 |
|
| 191 |
+
| Block size | 512 |
|
| 192 |
+
| Training steps | 8,000 |
|
| 193 |
+
| Memory optimisation | Level-2 grad checkpoint + Stage-1.5b gathered V_phi |
|
| 194 |
+
| Hardware | A100 40GB (Google Colab) |
|
| 195 |
+
|
| 196 |
+
### Training Script
|
| 197 |
+
|
| 198 |
+
[`notebooks/conservative_arch/scaleup/train_parf_multixi_scaleup.py`](https://github.com/dimitarpg13/semsimula-paper/blob/main/notebooks/conservative_arch/scaleup/train_parf_multixi_scaleup.py)
|
| 199 |
+
|
| 200 |
+
## Evaluation Results
|
| 201 |
+
|
| 202 |
+
### TinyStories Validation Perplexity
|
| 203 |
+
|
| 204 |
+
| Model | PPL | Params | Gap vs Attention |
|
| 205 |
+
|---|---|---|---|
|
| 206 |
+
| Matched Attention (baseline) | **7.81** | 19.5M | -- |
|
| 207 |
+
| [Hybrid SPLM+Attn](https://huggingface.co/dimitarpg13/semsimula-hybrid-splm) | **8.50** | ~19.0M | +0.69 |
|
| 208 |
+
| [Fock-PARFLM v2.1](https://huggingface.co/dimitarpg13/semsimula-fock-parflm) | **9.30** | 17.4M | +1.49 |
|
| 209 |
+
| [Fock Attention](https://huggingface.co/dimitarpg13/semsimula-fock-attention) | **9.42** | 16.7M | +1.61 |
|
| 210 |
+
| **Multi-Xi PARFLM** (this model) | **12.06** | 17.6M | +4.25 |
|
| 211 |
+
| [Multi-Xi SPLM](https://huggingface.co/dimitarpg13/semsimula-splm-multixi) | **14.69** | 16.5M | +6.88 |
|
| 212 |
+
|
| 213 |
+
Adding sparse pairwise forces (V_phi) improves PPL from 14.69 to 12.06 over the standalone Multi-Xi SPLM, confirming that pairwise token interactions are a necessary complement to the single-body potential. The remaining gap to attention is closed further by the Fock register mechanism.
|
| 214 |
+
|
| 215 |
+
## SPLM Family Overview
|
| 216 |
+
|
| 217 |
+
This model is part of the **Semantic Simulation SPLM family**:
|
| 218 |
+
|
| 219 |
+
| Model | Design | HuggingFace |
|
| 220 |
+
|---|---|---|
|
| 221 |
+
| Multi-Xi SPLM | Pure scalar potential, K-EMA context | [semsimula-splm-multixi](https://huggingface.co/dimitarpg13/semsimula-splm-multixi) |
|
| 222 |
+
| Hybrid SPLM+Attn | Attention front-end + SPLM refinement | [semsimula-hybrid-splm](https://huggingface.co/dimitarpg13/semsimula-hybrid-splm) |
|
| 223 |
+
| Multi-Xi PARFLM | Scalar potential + sparse pairwise forces | [this model](https://huggingface.co/dimitarpg13/semsimula-parflm-multixi) |
|
| 224 |
+
| Fock-PARFLM v2.1 | PARFLM + Fock register pool (mediated exchange) | [semsimula-fock-parflm](https://huggingface.co/dimitarpg13/semsimula-fock-parflm) |
|
| 225 |
+
| Fock Attention | PARFLM + direct token-to-token exchange | [semsimula-fock-attention](https://huggingface.co/dimitarpg13/semsimula-fock-attention) |
|
| 226 |
+
|
| 227 |
+
## Bias, Risks, and Limitations
|
| 228 |
+
|
| 229 |
+
- **Research checkpoint only.** Proof-of-concept for the conservative pairwise-force architecture.
|
| 230 |
+
- **TinyStories only.** Trained exclusively on synthetic children's stories (~5M tokens).
|
| 231 |
+
- **English only.** No multilingual capability.
|
| 232 |
+
- **Small scale.** 17.6M parameters, 256-dim hidden states.
|
| 233 |
+
- **No safety training.** No RLHF, DPO, or safety filtering has been applied.
|
| 234 |
+
|
| 235 |
+
## Citation
|
| 236 |
+
|
| 237 |
+
```bibtex
|
| 238 |
+
@misc{Gueorguiev2026SemSim,
|
| 239 |
+
author = {Gueorguiev, Dimitar P.},
|
| 240 |
+
title = {Semantic Simulation: A Prescriptive Lagrangian Framework
|
| 241 |
+
for Efficient Semantic Inference --- A Conservative-by-
|
| 242 |
+
Construction Language Model and the Shared-Potential
|
| 243 |
+
Separator, with a Correspondence to Joint Embedding
|
| 244 |
+
Predictive Architectures},
|
| 245 |
+
year = {2026},
|
| 246 |
+
publisher = {Zenodo},
|
| 247 |
+
doi = {10.5281/zenodo.20579593},
|
| 248 |
+
url = {https://doi.org/10.5281/zenodo.20579593},
|
| 249 |
+
note = {Version v15 (Jun 7, 2026).
|
| 250 |
+
Companion code repository (DOI 10.5281/zenodo.20579561):
|
| 251 |
+
\url{https://github.com/dimitarpg13/semsimula-paper}}
|
| 252 |
+
}
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
## Environmental Impact
|
| 256 |
+
|
| 257 |
+
- **Hardware:** NVIDIA A100 40GB (Google Colab)
|
| 258 |
+
- **Training time:** ~6 hours (8,000 steps with gradient checkpointing)
|
| 259 |
+
- **Carbon footprint:** Estimated < 2 kg CO2
|
config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "MultiXiPARFLM",
|
| 3 |
+
"model_family": "semsimula-splm",
|
| 4 |
+
"vocab_size": 50257,
|
| 5 |
+
"d": 256,
|
| 6 |
+
"n_layers": 8,
|
| 7 |
+
"v_hidden": 1024,
|
| 8 |
+
"v_depth": 3,
|
| 9 |
+
"max_len": 1024,
|
| 10 |
+
"block_size": 512,
|
| 11 |
+
"gamma": 0.30,
|
| 12 |
+
"xi_channels": 8,
|
| 13 |
+
"xi_alpha_inits": "log_spaced",
|
| 14 |
+
"v_phi_kind": "structural_competitive",
|
| 15 |
+
"v_phi_hidden": 128,
|
| 16 |
+
"top_k": 8,
|
| 17 |
+
"gumbel_tau_start": 1.0,
|
| 18 |
+
"gumbel_tau_end": 0.1,
|
| 19 |
+
"mass_model": "logfreq",
|
| 20 |
+
"integrator": "semi_implicit_euler",
|
| 21 |
+
"ln_after_step": true,
|
| 22 |
+
"use_gathered_v_phi": true,
|
| 23 |
+
"use_layer_checkpoint": true,
|
| 24 |
+
"total_parameters": 17632215,
|
| 25 |
+
"best_val_ppl": 12.06,
|
| 26 |
+
"training_steps": 8000,
|
| 27 |
+
"dataset": "roneneldan/TinyStories"
|
| 28 |
+
}
|