Add a hidden layer
Use two numbers to see how Tanh transforms a signal inside a hidden layer.
A hidden layer computes intermediate features for the next layer to use in prediction. A nonlinear function between layers lets the model respond differently to weak and strong signals.
A small example
Consider a control whose output approaches a maximum of one. With Tanh, an input of 1 gives about 0.76, and 2 gives about 0.96. Doubling the input moved the output closer to its limit. No single constant multiplier reproduces both results.
What does the extra layer buy us?
First pass the number 2 through two plain multiplications. A first layer that multiplies by 3 followed by a second that multiplies by 4 produces 24. One layer multiplying by 12 would give the same result for every possible input.
Now put Tanh between the multiplications. A large positive signal comes out close to one. The second layer receives nearly the same value for inputs of 2 and 20, even though one input is ten times larger. A feature like this can tell the next layer that a strong signal is present.
See it happen
Follow the numbers through the layers.
Each step changes only one thing. The weights stay fixed while you follow the calculation.
- Input
- Embedding
- Join
- Linear
- Tanh
- Scores
Two word indices
[3, 4]
Shape [1, 2]: one example, two positions.
Stage 1 of 6: Input.
Three scores for a numerical walkthrough with assigned weights and zero biases. The project output covers its entire vocabulary. This is not a full LLM.
Done reading?
Mark the lesson as read to move your track progress forward.
Lesson marked as done.
Now build your own version
Add a hidden layer to your model. Check the intermediate numbers and verify that its parameters can receive training gradients.
What practice includes and how much it costs
MCP includes the full lesson and a local project with starter files. Work through the task with your agent, ask for a hint and run the checks on your computer.
One payment, no auto-renewal · Terms
Progress saved in this browser
Clear your history or open this on your phone, and the marks will be gone. Leave your email and they'll move to your account. No password needed.
Done. moved to your account. You can see your progress on any device. My progress