#187From scratch — does this init break symmetry?Easy

From scratch — does this init break symmetry?

Background

Why are weights initialised randomly instead of to zero? If every hidden unit starts with the same incoming weights, they compute the same output and receive the same gradient — so they stay identical forever and the hidden layer effectively has one unit. Random init breaks the symmetry so units can specialise.

For a weight matrix W of shape (input_size, hidden_size) (each column is one hidden unit's incoming weights), symmetry is broken iff not all columns are identical.

Problem statement

Implement breaks_symmetry(W) returning True if the hidden units start out distinguishable (columns not all equal), else False.

Input

  • W — array-like of shape (input_size, hidden_size).

Output

Returns a bool.

Examples

Example 1 — zero init fails

Input:  W = [[0, 0, 0], [0, 0, 0]]
Output: False

Explanation: all columns identical → all hidden units identical → symmetry not broken.

Example 2 — random-looking init works

Input:  W = [[1, 2, 3], [4, 5, 6]]
Output: True

Explanation: the three columns differ, so the units start distinct.

Example 3 — nonzero but still symmetric

Input:  W = [[1, 1], [2, 2]]
Output: False

Explanation: both columns are [1, 2] — identical units despite nonzero weights.

Constraints

  • Compare columns: symmetry is broken iff at least one column differs from the first.
  • Return a Python bool.

Notes

  • Biases can safely start at zero — it's the weights whose symmetry must be broken, because they multiply the (varying) inputs.
Python
Loading...

▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.

  • Example: zero init does not break symmetry
  • Reference: distinct columns break symmetry
  • Sample: nonzero but identical columns stay symmetric