PSSA: A non-transformer language model written from scratch in Rust

In this news:

Key takeaways

  • PSSA is a custom non-transformer language model built entirely in Rust without PyTorch or TensorFlow.
  • It learns faster and generates text faster on CPUs compared to standard transformer models.
  • The model features a recurrent state-space core, an episodic memory bank, and plastic weights.

Overview of PSSA

PSSA is a small language model that is not a transformer. It reads text one token at a time through a recurrent state-space layer, keeps a bank of episodic memories it can look things up in, and rewrites part of its own weights while it runs. It is written in Rust from scratch, with no PyTorch, no TensorFlow, and no ML framework of any kind underneath it.

At matched parameters and on the same corpus, it learns faster than a transformer and generates text about twelve times quicker on the same CPU.

A transformer scores every pair of tokens in the context, so its cost per step grows with the square of the sequence length and the whole context is re-read at every step. PSSA carries one fixed-size state along the sequence in a single left-to-right pass, and looks things up in a memory bank instead of re-reading the context, so cost grows linearly with length.

Training and Generalization Performance

Two models, same corpus, same tokenizer, same optimizer schedule, same seed, same number of parameters. One is PSSA, one is a standard transformer. Over 12.7M tokens of cleaned WikiText-103:

PSSA finished at 3.98 training cross-entropy, the transformer at 4.43. That is a gap of 0.45 nats, perplexity 53.7 against 83.7. The transformer spent its entire 12.7M-token budget to reach a loss PSSA had already passed around 2M tokens in.

The two curves never cross, and they never touch:

Training loss only says a model fit the stream it was fed. So both checkpoints were scored on a 198,939-token slice cut from a part of the corpus neither run ever touched:

Every checkpoint of both runs, 64 PSSA links and 43 transformer links, scored on a bounded 9,934-token window of that unseen slice. The curves never cross: PSSA is ahead from the first link and finishes 0.51 nats lower. The table below is the final checkpoint of each run on the full slice.

The held-out gap, 0.43 nats, is essentially the training gap. PSSA is not memorizing harder, it is generalizing better.

Generating 200 tokens on the same CPU, same prompt, same sampler:

A recurrent model carries a fixed-size state, so the cost of each new token does not grow with the length of what came before. A transformer re-reads its whole context every step.

Architectural Components

A recurrent state-space core. Learned continuous state matrices carry information forward in a fixed-size state, instead of attention over the full context window.

An episodic memory bank. 512 slots with hyperbolic retrieval and bounded top-4 search, written to and read from during the run.

Plastic weights. Fast updates reinforce what works, novelty drives growth, and a refractory gate rate-limits overwrites so repeated contradictory input does less damage.

Closed-form consolidation. A ridge-regression step folds the fast plastic updates back into the base transition matrix, the way sleep consolidates a day's learning.

No framework. Hand-written linear algebra in Rust, with a CUDA path for training and a scalar CPU reference that every gradient is checked against.

Share the article:

Top Trending Cryptocurrencies on The Market

Current Price

$285.97

7 Days
BCH 7 days: +6.24%

Market Cap

$5.8B 3.13%

24h Volume

$129.2M

Supplies

20.1M / 21.0M

Current Price

$61.727

7 Days
LTC 7 days: +3.94%

Market Cap

$4.8B 2.90%

24h Volume

$214.7M

Supplies

77.7M / 84.0M

Current Price

$0.9466

7 Days
USDB 7 days: +8.25%

Market Cap

$4.7B 16.85%

24h Volume

$288.4K

Supplies

10.0B / 10.0B

Current Price

$7.558

7 Days
UNI 7 days: +6.85%

Market Cap

$4.7B 4.03%

24h Volume

$427.7M

Supplies

887.0M / 1.0B

Current Price

$0.9997

7 Days
USDE 7 days: +0%

Market Cap

$4.7B 0.01%

24h Volume

$39.7M

Supplies

4.7B / ∞

Current Price

$0.9996

7 Days
No 7d data

Market Cap

$4.5B -0.07%

24h Volume

$231.1M

Supplies

4.5B / ∞

Current Price

$0.1112

7 Days
CC 7 days: +9.44%

Market Cap

$4.4B 7.85%

24h Volume

$19.7M

Supplies

39.9B / ∞

Current Price

$1.036

7 Days
SUI 7 days: +1.63%

Market Cap

$4.3B 3.31%

24h Volume

$578.7M

Supplies

10.0B / 10.0B

Current Price

$0.9992

7 Days
USD1 7 days: -0.04%

Market Cap

$4.1B 0.02%

24h Volume

$886.9M

Supplies

4.1B / ∞

Current Price

$1.352

7 Days
No 7d data

Market Cap

$3.8B 1.77%

24h Volume

$29.0M

Supplies

5.3B / ∞

Current Price

$0.08521

7 Days
HBAR 7 days: +0.97%

Market Cap

$3.8B 3.69%

24h Volume

$105.3M

Supplies

50.0B / 50.0B

Current Price

$4,113.31

7 Days
XAUT 7 days: +0.18%

Market Cap

$3.3B 0.07%

24h Volume

$205.7M

Supplies

827.4K / ∞

Notifications Login to see

Today

No Notifications

↑