ISN Shakespeare: Character-level Language Model

DOI: 10.5281/zenodo.19141133 Models: Hugging Face GitHub: GFN Framework

This repository contains the weights and configuration for a Shakespeare-style language model built using the Inertial State Network (ISN) architecture.

πŸš€ Highlights

  • Architecture: Inertial State Network (ISN).
  • Parameters: 363,329 (Equivalent to nanoGPT baseline).
  • Inference Efficiency: Constant $O(1)$ VRAM and $O(1)$ per-step time scaling.
  • Performance: 2.48 PPL on TinyShakespeare (Official).
  • Train seq_lenght: 128

πŸ’» Technical Usage (Inference)

To run inference locally, you need the GFN Framework installed.

1. Install GFN Framework

pip install gfn==v2.7.1

2. Clone this repository

git lfs install
git clone https://huggingface.co/DepthMuun/gfn-isn-shakespeare-char
cd gfn-isn-shakespeare-char

3. Run Inference Script

The repository includes an inference.py script for interactive generation:

python inference.py

Python API Example (Manual Assembly)

As shown in the audited inference.py, the official way to load ISN models is:

import torch
import json
from gfn import isn

# 1. Load Config
with open("config.json", "r") as f:
    config = json.load(f)

# 2. Instantiate Model (Manual Schema)
model = isn.create(
    vocab_size=65,  # Unique characters in tinyshakespeare.txt
    d_model=config['model']['d_model'],
    d_embedding=config['model']['d_embedding'],
    d_properties=config['model']['d_properties'],
    scanner_cls=isn.GFNScanner,
    world_cls=isn.GFNWorld,
    emitter_cls=isn.GFNEmitter
).to("cpu")

# 3. Load State Dict
checkpoint = torch.load("best_model.pt", map_location="cpu")
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()

# 4. Generate Text
# Use model.generate() or the provided inference.py CLI

πŸ“œ Citation

If you use this work, please cite:

@article{sturtz2026geometry,
  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.19141133}
}

πŸ”— Resources

Downloads last month
54
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using DepthMuun/gfn-isn-shakespeare-char 1

Evaluation results