Ryno banner

Ryno‑0.8B — an LLM whose attention keeps its memory in a database

Ryno is a 0.8 B‑parameter language model built on a Qwen3.5 trunk and post‑trained with three additions we designed: DBAttention (K/V state in a database, fetched inside attention), SublayerNets (nested residual sublayers) and MuonClip (Muon + QK‑Clip; no Adam on any matrix parameter).

parameters 805.6 M · one model.safetensors, 1.37 GB fp16, 1013 tensors
trunk Qwen3.5‑0.8B: 25 blocks (18 gated‑DeltaNet + 6 attention), d=1024, ffn=3584, 8 q / 2 kv heads, head_dim 256, vocab 248 320, tied head
context 262 144 native · 2 000 000 with DBAttention
KV cache none in the model — rows live in a store you point at
peak VRAM 1.94 GB fp16

The two papers behind this model

Both are published as citable preprints on Zenodo. Two separate DOIs, one per paper.

# Paper DOI PDF in this repo
1 DBAttention — Database-Backed Attention with External Key-Value Memory for Persistent, Near-Unbounded Context Inference 10.5281/zenodo.24529787 papers/DBAttention-preprint-v1.0.pdf
2 SublayerNets — What Depth Buys When Parameters Are Held Fixed 10.5281/zenodo.24530110 papers/SublayerNets-preprint-v1.0.pdf

BibTeX for both is in the Citation section below, and in papers/DBATTENTION.bib and papers/SUBLYERNETS.bib.

Note :

"Training used the MuonClip optimizer (Kimi AI / Moonshot AI), which combines Muon with QK-Clip for attention-logit stability."

What is DBAttention, why, and how

What. Normally a transformer keeps every past key and value in GPU memory, and that buffer grows with the conversation until it hits the card's limit. In Ryno the attention block writes its K/V rows to a database and reads back the rows it needs, inside the attention computation. The model holds no KV cache.

Why. Context stops being a VRAM problem and becomes a storage‑and‑bandwidth problem. Also, a stored KV row is reusable across requests and across sessions.

How — one attention block, end to end:

DBAttention flow

Two policies, chosen when you enable it:

policy fetch use it when
window=None the whole stored history of that layer exact attention, storage‑bandwidth bound
window=N only the last N tokens streaming chat, unbounded conversation

Measured (RynoSor‑0.8B weights, one 8 GB device, int8 rows, chunk 256):

tokens VRAM, model‑resident KV VRAM, DBAttention store argmax vs native prefill tok/s
512 1.61 GB 1.56 GB 3.5 MB identical 1 313 → 3 012
4 096 3.04 GB 1.68 GB 27.2 MB identical 3 251 → 3 057
4 096, window=1024 — 1.58 GB 27.2 MB identical 3 471
8 192 OOM 1.61 GB 54.1 MB no reference 3 457

Two more measured facts that people usually get wrong:

  • one shared database for all layers does not save space — six per‑layer stores and one store with (session, layer, block) keys both take 168.5 MB for 40 000 rows. Sharing saves operations, not bytes.
  • only 6 of 25 blocks need rows at all; the 18 gated‑DeltaNet blocks carry a constant‑size recurrent state. 2 M tokens = 49.2 GB fp16 / ≈17.7 GB int8, not 204 GB.

What are SublayerNets, why, and how

What. Each block's update is computed by a small stack of sublayers rather than one linear map. Depth 2 means two nested residual refinements of the same update.

Why. More representational depth per parameter: 811 K extra parameters, measured 0.97 % loss shift from depth 1 → 2.

How — the bridge is tanh(bg) · (x·W_b)·W_u:

SublayerNets flow

A finding we publish because it bit us: with bg = 0 the bridge is dead by construction — ∂L/∂W_b = ∂L/∂W_u = 0 because the gradient is multiplied by tanh(0). Our earlier checkpoint measured CE(on) − CE(off) = 0.0000 nats exactly. bridge_init is now non‑zero; the released weights predate that fix, so the sublayer bridges here are inert rather than harmful.


Run it

pip install -r requirements.txt

# 1. the model, with DBAttention and a store you choose
python db_attention_demo.py --tokens 2048
python db_attention_demo.py --tokens 20000 --window 4096   # bounded working set

# 2. the benchmark behind the table below
python bench/run_benchmark.py --model . --max-new 96

Does transformers load it?

Yes — with trust_remote_code=True. Everything is declared in config.json (model_type: ryno, auto_map → configuration_ryno / modeling_ryno), so the standard entry points work:

import torch
from transformers import AutoConfig, AutoModel, AutoTokenizer

cfg   = AutoConfig.from_pretrained("FuryLogic-Labs/Ryno-0.8B", trust_remote_code=True)
model = AutoModel.from_pretrained("FuryLogic-Labs/Ryno-0.8B", trust_remote_code=True,
                                 config=cfg, torch_dtype=torch.float16)
tok   = AutoTokenizer.from_pretrained("FuryLogic-Labs/Ryno-0.8B", trust_remote_code=True)

What is not automatic: model.generate() from a stock transformers pipeline will not route K/V through the store — DBAttention is our runtime, not a HF Cache subclass. Enable it explicitly and use our decode loop:

model.enable_db_attention(path=".ryno-db/serve.db", max_tokens=2_000_000, window=None)
print(model.chat("What is the capital of France?", max_new_tokens=64))
print(model.db_stats())     # {'enabled': True, 'tokens': ..., 'cap': 2000000, 'db_mb': ...}
model.disable_db_attention()   # back to the native in-VRAM path

ingest(text) prefills long context straight into the store in 512‑token chunks, so you can read a document far larger than VRAM and then query it.

SublayerNets

The runtime can also load and apply SublayerNets — each block runs twice, the second time blended per token by a router gate, plus a bridge that re-injects the block input:

print(model.sublayer_stats())     # what the checkpoint carries
model.enable_sublayers()          # depth 2; pass depth=3 for deeper stacks
model.disable_sublayers()         # back to one pass per block

What the released checkpoint contains, stated precisely: 24 bridge pairs with gate tanh(bg) = 0 and router rw = 0, rb = −3, i.e. a constant gate of 0.047 with no bridge contribution. Enabling them therefore perturbs logits by max |Δ| = 0.086 without changing the top token — they were never trained, so they are shipped for a future retrain, not as a working mechanism. A checkpoint trained with bridge_init > 0 moves the output for real (live: True in sublayer_stats()).

Text results

80 novel multiple‑choice items (12 each math / physics / chemistry / science / code, 20 banking77), scored by generation with a 96‑token budget:

model math physics chemistry science code banking77 total
frozen trunk, no adapters 0 0 17 17 8 80 26.2 %
Ryno‑0.8B 92 92 92 67 100 50 78.8 %

Health vs the frozen trunk: CE 2.370 nats (PPL 10.69), KL 0.114 nats, entropy ratio 0.96, top‑1 agreement 82.9 %. An earlier run collapsed (KL 23.17, agreement 1.3 %) and answered "D" to everything — the anchor exists because of that.

Limitations

  • Vision is ongoing development. Image/video understanding is not claimed here; the file contains vision tensors for future work and they are not used.
  • SublayerNet bridges are inert in these weights (see above) — a training‑time fix, not active in this release.
  • banking77 regressed from the trunk's 80 % to 50 %; our supervised data is maths‑shaped.
  • Chat is weak. Training was multiple‑choice reasoning, so small talk drifts and identity questions should be answered from a system prompt, not the weights.
  • DBAttention limits: parity is measured as greedy argmax and max |Δlogit| (≤ 0.20 with int8 rows), not full KL. Single‑token decode latency with the store in the loop is not yet measured.

Files

config.json · model.safetensors · configuration_ryno.py · modeling_ryno.py · tokenizer.json (+ config, special tokens) · generation_config.json · db_attention_demo.py · bench/ · ryno/ (runtime: kv_db.py, db.py, qwen35.py, …) · ARCH.md · banner.jpg · CITATION.cff · papers/ (both preprints as PDF)

Citation

@misc{mahir2026dbattention,
  title        = {DBAttention: Database-Backed Attention with External Key-Value
                  Memory for Persistent, Near-Unbounded Context Inference},
  author       = {Mahir, Irfan},
  year         = {2026},
  month        = nov,
  publisher    = {Zenodo},
  organization = {FuryLogic Labs, Dhaka, Bangladesh},
  doi          = {10.5281/zenodo.24529787},
  url          = {https://doi.org/10.5281/zenodo.24529787},
  note         = {Preprint v1.0}
}

@misc{mahir2026sublayernets,
  title        = {SublayerNets: What Depth Buys When Parameters Are Held Fixed},
  author       = {Mahir, Irfan},
  year         = {2026},
  month        = nov,
  publisher    = {Zenodo},
  organization = {FuryLogic Labs, Dhaka, Bangladesh},
  doi          = {10.5281/zenodo.24530110},
  url          = {https://doi.org/10.5281/zenodo.24530110},
  note         = {Preprint v1.0}
}

@misc{ryno2026,
  title  = {Ryno-0.8B: an LLM with database-backed attention},
  author = {FuryLogic Labs},
  year   = {2026},
  note   = {Dhaka, Bangladesh. furylogic.com}
}
Downloads last month
-
Safetensors
Model size
0.8B params
Tensor type
I64
·
F32
·
F16
·
I8
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for FuryLogic-Labs/Ryno-0.8B

Finetuned
(1,064)
this model

Evaluation results