Architectures / NLP
🔄 Simple RNN
Simple Recurrent Neural Network for sequence processing
Layers
4
Parameters
1.10M
Input
128 × 300
Output
128 × 10
Verifier
Clean
Every number on this page is computed from the graph by the same functions the app runs, not written by hand.
Open Simple RNN on the canvas
Free, no account needed
When to pick it
Pick as a teaching reference. Real workloads should reach for LSTM/GRU or transformer — vanilla RNN suffers from vanishing gradients on anything beyond ~50 steps.
Structure
4 layers. Output shapes are propagated from the input shape, batch dimension excluded.
| Layer | Type | Parameters | Output shape | |
|---|---|---|---|---|
| 1 | Input | Input | shape=[128, 300] | 128 × 300 |
| 2 | LSTM | LSTM | hiddenSize=256, numLayers=2 | 128 × 256 |
| 3 | Linear | Linear | outFeatures=10 | 128 × 10 |
| 4 | Output | Output | 128 × 10 |
What the verifier says
The same 41 structural checks that run on every edit in the app, on this graph.
No finding. Shapes propagate end to end, every divisibility condition holds, and no advisory rule fires. See the checks.
The PyTorch it exports
Generated from the graph above.
# Architecture designed with Neurarch: https://neurarch.com
# PyTorch: compatible with Python 3.8+ and torch>=1.12
# Colab: pip install torch torchvision (usually pre-installed)
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple
class SimpleRNN(nn.Module):
def __init__(self):
super().__init__()
self.lstm_1 = nn.LSTM(300, 256, num_layers=2, batch_first=True)
self.linear_1 = nn.Linear(256, 10)
def forward(self, x):
# Input shape: [128,300]
lstm_lstm_1 = self.lstm_1(x)[0]
linear_near_1 = self.linear_1(lstm_lstm_1)
# Output
return linear_near_1
if __name__ == '__main__':
model = SimpleRNN()
model.eval()
x = torch.randn(1, 128, 300) # (batch, channels, length)
with torch.no_grad():
output = model(x)
print(f'Input shape : {tuple(x.shape)}')
print(f'Output shape : {tuple(output.shape)}')
total = sum(p.numel() for p in model.parameters())
trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)
print(f'Parameters : {total:,} total, {trainable:,} trainable')
For agents
This architecture is machine-readable end to end. An agent can list the set, fetch this graph, edit it, and have the edit verified before any GPU time is spent.