What changes when we remove the hidden activation?

Explore dataset (opens in a new tab)
Run on Molab
  1. Download the notebook.
  2. Open Molab (opens in a new tab), sign in, and import the downloaded Python notebook.
  3. Write a prediction, run the reference, then change one condition. These small experiments run on CPU.

Your notebook runs in your Molab workspace. Download its report to keep your evidence.

The article What a weight matrix does and why we need nonlinearity explains how a hidden representation can make XOR separable. Here we hold a small network’s weights fixed and remove one operation. You need matrix–vector multiplication and the rule ReLU⁡(z)=max⁡(0,z)\operatorname{ReLU}(z)=\max(0,z).

Four inputs occupy the corners (±1,±1)(\pm1,\pm1). Opposite signs mean class 1; matching signs mean class 0. The hidden matrix is

W=[1−s−s1],h=ReLU⁡(Wx).W=\begin{bmatrix}1&-s\\-s&1\end{bmatrix},\qquad \mathbf h=\operatorname{ReLU}(W\mathbf x).

The output score is h1+h2−τh_1+h_2-\tau. A strictly positive score predicts class 1; a zero or negative score predicts class 0. The weights are chosen by hand. Nothing is trained or refitted between runs.

Establish a reference

Use ReLU, s=1s=1, and threshold τ=1\tau=1. Predict each hidden vector and all four labels before running. In the resulting table, compare the coordinates before and after the activation. The plot shows the hidden representations with their true classes retained.

Remove only the activation

Keep the matrix, threshold, inputs, and true labels fixed. Predict what changes when Hidden activation becomes Identity (no activation). Record that run and compare its hidden vectors, scores, and accuracy with the reference.

Experiment bench

Four fixed XOR inputs (±1, ±1). W = [[1, −s], [−s, 1]], hidden bias zero. Score = h₁ + h₂ − threshold; class 1 when score > 0, otherwise class 0. Hand-chosen weights; no training or refitting.

Load the reference, write a prediction, and run it first. For each comparison, change only the condition named in the lesson. Each run is calculated here in your browser.

Reference settings selected · 0/16 runs

Loading reference settings preserves your evidence. Work is saved in this tab across navigation and reloads. Download your report to keep it after closing the tab.

No run recorded yet.

Build your explanation from the evidence

Explain why the same output weights now receive different coordinates. An accuracy change alone does not tell us which intermediate computation caused it.

Compare the representations

With ReLU, matching-sign inputs produce (0,0)(0,0), while the other two produce (0,2)(0,2) and (2,0)(2,0). The reference scores are −1, −1, 1, and 1: all labels are correct.

Without the activation and with the reference s=1s=1, the two coordinates of WxW\mathbf x always sum to zero. Every score becomes −1, so all four inputs receive class 0 and accuracy is 50%. For a general ss, that sum is (1−s)(x1+x2)(1-s)(x_1+x_2), so changing the matrix can change these scores. This is the outcome for the fixed head we tested, not a claim that every linear classifier has exactly 50% accuracy on XOR.

Design your own comparison

Restore the reference. Choose another threshold from the available settings, predict the four labels, and run it while keeping the representation fixed. Find two different thresholds that both classify all four points correctly. Then test a threshold at the boundary where one class stops being correctly classified.

For a separate intervention, restore threshold 1 and keep ReLU. Change only ss to a value you choose. Before testing, calculate how this changes both matrix columns. Does keeping an activation guarantee that any weight matrix will solve the task?

For your independent comparisons, use Comparison baseline to select a recorded run that differs in only the condition you are testing.

Report and transfer

Your report should separate the fixed-weight ablation from the broader question of whether a linear classifier can solve XOR at all. Describe the intermediate evidence and one limitation of using hand-chosen weights.

On paper, could different weights or more layers solve all four XOR cases if every hidden activation remained the identity? Compare the midpoint of the two class-0 inputs with the midpoint of the two class-1 inputs. Use this to make an argument about any affine score, beyond the particular weights we tested.

Check the broader claim

For the reference hidden vectors, every threshold satisfying 0≤τ<20\le\tau<2 works under our strict-positive decision rule. At τ=2\tau=2, the class-1 scores become zero and are classified as 0.

No affine score in the original plane can classify all four XOR points correctly. Both opposite-corner pairs have midpoint (0,0)(0,0). The average affine score of each pair therefore equals the score at that same midpoint. One pair cannot have both scores positive while the other has both scores nonpositive. Stacking affine layers still produces an affine map, so depth alone does not remove this obstruction.

Continue experimenting

Previous: What breaks when backpropagation forgets a path? · Next: Which shifts does pooling actually ignore? · All machine learning experiments