← all repositories
antirez/neural-redis

Redis learns to add numbers, mostly

A Redis module that stuffs feed-forward neural networks into your key-value store so you can train and predict without leaving your database.

neural-redis
Velocity · 7d
+0.6
★ / day
Trend
steady
star history

What it does Neural Redis is a loadable C module that turns Redis into a machine-learning engine. You create networks with NR.CREATE, feed them observations via NR.OBSERVE, and train them with NR.TRAIN — all inside the server. It handles regression and classification tasks, auto-normalizes your data, and keeps training in a background thread so queries don’t block.

The interesting bit The clever part is the zero-infrastructure pitch: no Python environments, no model serialization headaches, no separate inference service. Antirez wrote the whole thing — module, README, and all — in about two days, and it shows in both the brisk API design and the frank “alpha code” warning. Training happens on a copy of the network; weights merge back later, so you can query a model while it’s still learning.

Key highlights

  • Native Redis commands: NR.CREATE, NR.OBSERVE, NR.TRAIN, NR.RUN, NR.CLASS
  • Automatic data normalization and simple overfitting detection via AUTOSTOP
  • Online training with RPROP; runs on a copy to avoid blocking reads
  • Classification mode transparently handles one-hot encoding for you
  • Only ~1000 lines of C, built against Redis unstable

Caveats

  • Explicitly alpha code; author warns it may crash your Redis server
  • AOF rewrite is unimplemented; only RDB persistence works
  • Sigmoid activation and RMS loss only — no ReLU, no convolutions, no recurrence
  • Auto-normalization can fail silently if your training data doesn’t span the full range you’ll later query

Verdict Worth a look if you want dead-simple ML for ranking, recommendations, or trend spotting without spinning up a separate pipeline. Skip it if you need computer vision, sequence models, or production-grade reliability.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.