Skip to main content

neurz

See RNN, LSTM, GRU, attention and CNN work, one operation at a time, forwards and backwards.

neurz is an educational desktop app that runs small neural networks with real NumPy arithmetic, records every operation and lets you play, pause, step and scrub through them like a video. Every number on screen is the number the network actually computed; every box, gate, wire and matrix can be clicked for an explanation in plain language, in detail or as a formula.

What you can watch

Model Task What is animated
RNN reads a word and predicts every next letter (neurz, or any word you type) the network unrolled in time: input, W_xh·x, W_hh·h, sum + bias, tanh, softmax
LSTM same task forget / input / output gates, candidate memory, the cell-state highway, f ⊙ c + i ⊙ c̃, o ⊙ tanh(c)
GRU same task reset and update gates, r ⊙ h, the candidate, the (1 − z)·h + z·h̃ mix
Attention same task, Transformer style embedding + position, q / k / v for every letter, scores, the causal attention matrix filling row by row, the weighted sum flowing into the prediction
CNN is an 8×8 picture a vertical bar, a horizontal bar or a plus? Or draw your own the 3×3 window sliding over the image, x ⊙ K and its sum, feature maps filling cell by cell, ReLU, max-pooling, flatten, dense, softmax
Compare the same word in RNN, LSTM, GRU and attention confidence in the right letter, the hidden state and the gradient reaching back to every step, side by side

LSTM backpropagation

  • Backpropagation through time: after the forward pass the error flows back step by step; violet bars show how much gradient reaches each letter, so the vanishing gradient becomes visible.
  • Train it yourself: type any word and the network learns it in the app (a small autograd engine + Adam, a fraction of a second). The Train… window shows the loss curve while you choose steps and learning rate, starting from the shipped or from random weights.
  • Change the weights by hand: Weights… shows every matrix as a heat map; turn the mouse wheel over a cell and the diagram and predictions update at once.
  • Playback: play / pause, step forward and back, jump to start or end, loop, speed 0.25×–8×, a timeline grouped by time step that you can click or drag.
  • Click to learn: every element opens a short bubble; the right panel explains it at three levels (Simple · Detailed · Math) with links to related concepts; hovering shows the exact numbers.
  • Lessons: a guided lesson per model, each step jumping to the moment it talks about, with a question at the end.
  • 10 interface languages (Türkçe, English, Azərbaycan Türkcəsi, Deutsch, Français, Español, Русский, العربية, فارسی, 中文; right-to-left for Arabic and Persian), 8 themes, your own interface and number fonts and text sizes.

Attention

Compare

Download (portable, nothing to install)

Every release on the Releases page carries ready-to-run builds:

System File How to start
Windows 10/11 neurz-<version>-windows-x64.exe double-click (SmartScreen: More info → Run anyway)
Linux x86-64 neurz-<version>-linux-x86_64.AppImage chmod +x neurz-*.AppImage && ./neurz-*.AppImage
macOS (Apple silicon) neurz-<version>-macos-arm64.zip unzip, then right-click neurz.app → Open (the app is not notarised)

Install

The desktop app (Python, PyPI):

pip install neurz
neurz        # or: nz

Python 3.10+ with PySide6 and NumPy; runs on Windows, Linux and macOS.

The same runs, step by step in the terminal or in your own code, without the window:

npm install -g neurz         # JavaScript (npm)
neurz run lstm

cargo install neurz          # Rust (crates.io)
neurz run cnn --sample plus
import { run } from "neurz";
const r = run("gru");        // r.steps: [{ phase, t, formula }], r.guesses, r.loss
let r = neurz::run("lstm", "").unwrap();   // r.steps, r.guesses, r.loss

All three packages are called neurz and share the same trained weights; neurz gui in the npm and Rust versions opens the Python desktop app if it is installed.

Command line

nz -V                              # version
nz models                          # list the models
nz run lstm                        # print every step with its numbers
nz run rnn --random --seed 3       # the same with untrained weights
nz run cnn --sample vertical
nz run gru --word kelebek          # any word: the network is trained on it first
nz run attn --lang de              # self-attention, narrated in German
nz concepts                        # every concept key
nz explain forget_gate --level math
nz update                          # upgrade with this Python's pip

Keyboard

Key Action
Space play / pause
→ / ← step forward / back
Home / End start / end
+ / − faster / slower
L loop
1 … 6 RNN · LSTM · GRU · Attention · CNN · Compare
B show / hide backpropagation
Ctrl+T / Ctrl+W train / weight matrices
Ctrl+L lesson
Ctrl+, settings
F1 F2 F3 Simple · Detailed · Math explanation

How it works

neurz.core has no Qt in it. core/autograd.py is a small reverse-mode autodiff engine on NumPy; core/nets.py uses it for training and for the gradients shown during backpropagation. Each model runs once (core/models.py) and writes every operation down as a frame: which elements are active, along which wires the data moves, every vector known so far and the formula with its numbers. The GUI player only moves through these frames, so stepping back never recomputes anything. The trained weights in core/weights.json come from tools/train_weights.py, which trains the tiny networks with plain finite-difference gradients, no deep-learning library needed.

Development

git clone https://github.com/bayramkotan/neurz
cd neurz
pip install -e .[dev]
pytest          # Python
npm test        # JavaScript (js/)
cargo test      # Rust (rust/)

Portable build for the machine you are on: pip install pyinstaller pillow and python packaging/build.py (result in dist/).

Pushing a vX.Y.Z tag runs .github/workflows/release.yml as one run: the tests of all three languages, portable builds on Windows, Linux and macOS attached to a GitHub release, and publishing to PyPI, npm (Trusted Publishing, no token) and crates.io (secrets: PYPI_API_TOKEN, CARGO_REGISTRY_TOKEN).

License

MIT. Bundled fonts: Inter and JetBrains Mono (SIL Open Font License 1.1).

Metadata

Release files for neurz 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neurz 0.0.4
File Size Uploaded Provenance Actions
neurz-0.0.4.tar.gz 1.3 MB Without provenance Details for neurz-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neurz 0.0.4
File Interpreter ABI Platform Actions
neurz-0.0.4-py3-none-any.whl Python 3 none any Details for neurz-0.0.4-py3-none-any.whl

Total release size: 2.5 MB

Release files / neurz-0.0.4.tar.gz

Download URL neurz-0.0.4.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
9f4a1a4950fb5f4a358582fd587505c18d005ba0f032ee4a79feda16b943ea7d
BLAKE2b-256 checksum
How to use checksums
e400d76fb746064afe229b8b572688c11b9c93905491450eb3cb58c90e2d93cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / neurz-0.0.4-py3-none-any.whl

Download URL neurz-0.0.4-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4c1af584d33fd647d13cb4445425027c8e6eb698f2a93add20accd308478ea23
BLAKE2b-256 checksum
How to use checksums
bf12f719c0f65f0008b249baedd66f5063a22cd44ccdd7bdb6407c216ca0c698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for neurz 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page