Skip to content
ENExplore Calculators

RNN Parameters Calculator

Calculate the number of trainable parameters in a recurrent neural network layer.

About RNN Parameters Calculator

A vanilla RNN layer has two weight matrices: W_ih (input to hidden, size input×hidden) and W_hh (hidden to hidden, size hidden×hidden), plus two bias vectors of size hidden. Total = input×hidden + hidden² + 2×hidden.

Formula

RNN Parameters

params = input_size × hidden_size + hidden_size^2 + 2 × hidden_size

input_size
Dimensionality of input features
hidden_size
Dimensionality of hidden state

Worked example

With the default values below, RNN Parameters Calculator returns Total Parameters of 394,240. Change any input above and every figure here is recalculated in your browser.

Inputs used

Input Sizeminimum 1
256
Hidden Sizeminimum 1
512
Include Biasone of Yes, No
Yes

Results

Total Parameters
394,240
Input Weights
131,072
Hidden Weights
262,144

Step by step

  1. 1Input→Hidden weights: input × hidden= 131,072
  2. 2Hidden→Hidden weights: hidden × hidden= 262,144
  3. 3Biases (input + hidden)= 1,024
  4. 4Total= 394,240

Assumptions and limits

  • The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

How do LSTM parameters compare to vanilla RNN?

LSTMs have 4× the parameters of a vanilla RNN because they have four gate matrices (input, forget, cell, output) instead of one.

Why does hidden size dominate parameter count?

The hidden-to-hidden matrix is h×h, which grows quadratically. For large hidden sizes (512+), this dominates total parameters.

RNN Parameters Calculator | Calcrivo