Downloads · 30 days
41
15% of all-time downloads
DepthMuun/gfn-gssm-xor-parity
gfn-gssm-xor-parity is a tabular classification model from DepthMuun. Use it for the tabular classification task on the model card, and read the license before you ship it in a product. It is set up for gfn. The card lists the license as cc-by-nc-nd-4.0.
[](https://doi.org/10.5281/zenodo.19141133) [](https://huggingface.co/DepthMuun) [](https://github.com/DepthMuun/gfn)
Downloads · 30 days
41
15% of all-time downloads
All-time downloads
273
Public
Repo size
143 MB
Likes
0
Public
Click a slice to open those files.
.png57.7 KB · 56%
From the Hugging Face model README
This repository contains the weights and configuration for the Geodesic State Space Model (G-SSM) specialized for XOR parity logic over arbitrary sequence lengths.
XOR parity over long bitstreams is an inherently periodic problem characterized by the discrete cyclic group $\mathbb{Z}_2 = {0, 1}$. Standard Euclidean architectures (RNNs, LSTMs, Transformers) struggle with length generalization on this task due to numerical floating-point drift, vanishing gradients, or attention context degradation.
G-SSM solves this by embedding the latent state into a compact circular manifold ($S^1$ / 1-torus):
1 imparts a geodesic impulse corresponding to a rotation of $\pi$ radians ($180^\circ$), while bit 0 imparts zero impulse.1 bits rotate the state by $2\pi \equiv 0 \pmod{2\pi}$, returning to the initial parity state. Symplectic integration (Yoshida) preserves phase coherence indefinitely.To run inference locally, install the GFN Framework.
pip install gfn
git lfs install
git clone https://huggingface.co/DepthMuun/gfn-gssm-xor-parity
cd gfn-gssm-xor-parity
Use the included inference.py script for an interactive test:
python inference.py
import math
import torch
from gfn import gssm
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# 1. Load model (resolves config.json in the same directory)
model = gssm.load("xor_best_model.bin", device=device)
model.eval()
# 2. Generate test sequence (e.g., 100,000 bits)
L = 100000
bits = torch.randint(0, 2, (1, L), device=device)
target_parity = (bits.sum() % 2).item()
# 3. Forward Pass
with torch.no_grad():
# G-SSM forward returns (logits, (pos, vel), info)
logits, (pos, vel), info = model(bits)
# 4. Geometric Decoding on S^1
PI = math.pi
TWO_PI = 2.0 * PI
half_pi = PI * 0.5
final_state = logits[0, -1, :] # State coordinates at final step
# Circular distance modulo 2*pi to +PI/2 (Parity 1)
dist_pos = torch.min(
torch.abs(final_state - half_pi) % TWO_PI,
TWO_PI - (torch.abs(final_state - half_pi) % TWO_PI)
).mean().item()
# Circular distance modulo 2*pi to -PI/2 (Parity 0)
dist_neg = torch.min(
torch.abs(final_state + half_pi) % TWO_PI,
TWO_PI - (torch.abs(final_state + half_pi) % TWO_PI)
).mean().item()
prediction = 1 if dist_pos < dist_neg else 0
print(f"Target Parity: {target_parity}")
print(f"Predicted : {prediction}")
print(f"Geom. Dist : +PI/2: {dist_pos:.4f}, -PI/2: {dist_neg:.4f}")
print("Status :", "CORRECT" if prediction == target_parity else "FAILED")
If loading raw checkpoints or customized configurations without gssm.load:
import json
import torch
from gfn import gssm
with open("config.json", "r") as f:
config = json.load(f)
model = gssm.create(config=config).to(device)
checkpoint = torch.load("xor_best_model.bin", map_location=device)
state_dict = checkpoint.get("state_dict") or checkpoint.get("model") or checkpoint
model_state = model.state_dict()
filtered_state = {k: v for k, v in state_dict.items() if k in model_state}
model.load_state_dict(filtered_state, strict=False)
model.eval()
If you use this work, please cite:
@article{sturtz2026gfn,
title={Geometric Flow Networks: A Physics-Informed Paradigm for Sequential Intelligence},
author={Stürtz, Joaquín},
journal={Zenodo Preprints},
year={2026},
doi={10.5281/zenodo.19141133},
url={https://doi.org/10.5281/zenodo.19141132}
}