Library / Building Blocks & Utilities
Building Blocks & Utilities
Train and run a neural network from webhooks using n8n Code nodes
Runs a feedforward neural network with backpropagation entirely inside JavaScript Code nodes, triggered by webhook calls, with no external ML services.
What it does
## 🧠 Deep Neural Network & Mesh Architecture in Pure n8n ### 📖 What is this workflow? This workflow demonstrates how to build and run a complete, fully functioning Deep Neural Network (DNN) with Vectorized Backpropagation using only native n8n nodes. No external Python scripts, no external containers, and no third-party ML APIs are needed. The entire computation—forward inference pass, ReLU activations, temperature-scaled Softmax, Categorical Cross-Entropy loss evaluation, and analytical gradient backpropagation—executes purely inside JavaScript Code nodes across an interconnected node mesh. --- ### 📐 Network Topology - Input Layer: 8 continuous numeric features per sample (x[0] to x[7]) - Hidden Layer 1: 9 parallel perceptron Code nodes (ReLU activation) - Hidden Layer 2: 9 parallel perceptron Code nodes (ReLU activation) - Hidden Layer 3: 9 parallel perceptron Code nodes (ReLU activation) - Output Layer: 4 linear logit projection units (z_1 to z_4) - Softmax Classifier: Numerically stable Softmax with temperature scaling (T = 0.1) - Loss Engine: Multi-class Categorical Cross-Entropy loss calculation - Training Engine: Vectorized Backpropagation with analytical gradients and persistent weights --- ### 🔄 Data Flow Summary 1. POST /predict: Ingests single sample or batch payloads. 2. Hidden Layer 1 (9 Nodes): Computes first-tier feature extractions in parallel. 3. Merge & Synthesis 1: Collects 9 neuron outputs into a combined 9-element feature vector H1. 4. Hidden Layer 2 (9 Nodes): Transforms H1 into intermediate abstract representations in parallel. 5. Merge & Synthesis 2: Gathers outputs into a consolidated feature vector H2. 6. Hidden Layer 3 (9 Nodes): Maps H2 into decision-boundary feature space in parallel. 7. Merge & Synthesis 3: Gathers outputs into the final latent vector H3. 8. Output Layer (4 Nodes): Computes 4 unnormalized class logit scores z. 9. Softmax & Loss: Converts logits into probabilities and evaluates accuracy against ground truth. 10. Delivery: Returns immediate, structured JSON prediction response via Respond to Webhook.
The steps
- Initialize Layer 1 Node 1
- Initialize Layer 1 Node 2
- Initialize Layer 1 Node 3
- Initialize Layer 1 Node 4
- Initialize Layer 1 Node 5
- Initialize Layer 1 Node 6
- Initialize Layer 1 Node 7
- Initialize Layer 1 Node 8
- Initialize Layer 1 Node 9
- Output Node 1
- Output Node 2
- Output Node 3
- Output Node 4
- Apply Final Softmax
45 steps in total.
Similar automations
MCP Servers & ToolsManage Action Network Events and Attendance via MCP Server24 stepsCustomer Support & HelpdeskTrain a WhatsApp Support Bot from Product Pages16 stepsCode, Git & Developer ToolsCheck n8n Workflows for Outdated Nodes by Email9 stepsCode, Git & Developer ToolsAudit n8n workflows for 3.0-breaking nodes and OpenAI model shutdowns14 steps