AetherStory

A from-scratch, CPU-trained storyteller transformer. ~863,492 parameters.

AetherStory is a tiny decoder-only transformer (GPT-style) trained entirely on CPU on the procedurally generated AetherStory dataset. It writes short fantasy fables given an opening prompt.

This is not a fine-tune of a larger model and not a wrapper around transformers โ€” every layer is implemented by hand in plain PyTorch.

Architecture

 token + position embeddings
            |
   +----------------+
   | Transformer x4 |
   |  causal MHA     |
   |  GELU FFN       |
   +----------------+
            |
        LayerNorm
            |
   tied output head
hyperparameter value
vocab size 10000
d_model 128
layers 4
heads 4
ffn dim 512
max seq len 64
parameters 863,492
tied embeddings True

Training

Trained with AdamW (lr 3e-4, cosine schedule, warmup 200) for 4 epochs on a 4-core CPU. Best validation loss: 0.3103, trained in unknown (recovered) on CPU.

loss curve

Usage

# files needed next to this script:
#   model.safetensors, config.json, tokenizer.json, modeling_aetherstory.py
from modeling_aetherstory import StoryTeller

teller = StoryTeller.from_dir(".")
print(teller("In the Glasslands there lived", max_tokens=100, temperature=0.9))

Limitations

A ~2M-parameter model trained on synthetic fables will not produce literature. It will produce charming, sometimes incoherent, fairy-tale-flavoured text โ€” which is the point. It is a demonstration that a small, fully custom model can be trained, evaluated, and shipped end-to-end on commodity hardware.

License

MIT.

Downloads last month
86
Safetensors
Model size
863k params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Space using wincode/aetherstory 1