Downloads · 30 days
0
sk16er/hope_nano
hope_nano is a text generation model from sk16er. Use it when you need the model to write or continue text. It is set up for pytorch. The card lists the license as mit.
A small (~44M parameter) language model trained on TinyStories, using an unofficial, educational reproduction of a Titans-style self-modifying memory layer with a multi-rate Continuum Memory System (CMS), inspired by…
Downloads · 30 days
0
Access
Public
Updated Jul 21, 2026
Repo size
530 MB
Likes
0
Public
Click a slice to open those files.
.pt530 MB · 100%
From the Hugging Face model README
A small (~44M parameter) language model trained on TinyStories, using an unofficial, educational reproduction of a Titans-style self-modifying memory layer with a multi-rate Continuum Memory System (CMS), inspired by Google Research's Nested Learning / HOPE architecture.
⚠️ Not an official Google model or implementation. This is an independent, from-scratch educational reproduction of the underlying ideas, trained at hobby scale on a free Colab GPU. It is not affiliated with or endorsed by Google.
Instead of standard causal self-attention, the core layer maintains a fixed-size memory matrix M that is read and rewritten every token with a gated delta rule:
α_t (forget) and β_t (write) are predicted per token, per attention head, directly from the input — the model learns how aggressively to overwrite its own memory as it processes text. Alongside this, a multi-rate CMS adds a small stack of MLP memory blocks that each refresh causally at a different period (every 1 / 4 / 16 tokens by default), giving the model both fast per-token memory and slower, longer-horizon memory, in place of a standard Transformer feed-forward block.
Educational: demonstrating a self-modifying, linearly-scaling alternative to softmax attention on a small, low-entropy dataset where even small models can produce fluent text. Not intended for production use, factual question-answering, or any application where reliability of outputs matters.
This model uses a custom architecture (model.py/config.py in the GitHub repo) rather than the transformers AutoModel API. To generate text:
git clone https://github.com/Sk16er/hope_nano
cd hope_nano
pip install -r requirements.txt
import torch, tiktoken
from huggingface_hub import hf_hub_download
from config import HOPEConfig
from model import HOPE
ckpt_path = hf_hub_download(repo_id="sk16er/hope_nano", filename="hope_latest.pt")
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
config = ckpt["config"]
model = HOPE(config)
model.load_state_dict(ckpt["model"])
model.eval()
tok = tiktoken.get_encoding("gpt2")
idx = torch.tensor(tok.encode("Once upon a time,"), dtype=torch.long).unsqueeze(0)
out = model.generate(idx, max_new_tokens=150, temperature=0.8, top_k=50)
print(tok.decode(out[0].tolist()))
Trained end-to-end using the accompanying Colab notebook, which:
If you build on this, please cite the underlying research this reproduces rather than this repo alone:
Behrouz, A. et al. Titans: Learning to Memorize at Test Time.
Google Research. Nested Learning: [HOPE architecture and Continuum Memory Systems].
Yang, S. et al. Parallelizing Linear Transformers with the Delta Rule over Sequence Length.
Architecture inspired by Google Research's Nested Learning / HOPE work and the Titans and DeltaNet papers. This is an independent, unofficial, educational reproduction.