Embeddings: Look Up Shared Parameters Without Detaching Them

IDs select trainable rows

A (V,D) table owns V*D scalar parameters.

IDs [2,0,2] return shape (3,D) but do not create new parameters.

What must remain identical when token 2 occurs twice?

1 / 8

Preserve scalar identity

Return references to table Value objects.

Copying a list can preserve those references; Value(old.data) cannot.

The latter produces plausible outputs with no gradient path to the table.

2 / 8

Work the position sum

Token rows: E[0]=[1,0], E[2]=[-1,1].

Positions: [0.1,0.2], [0.3,-0.1], [-0.2,0.4].

Combine for IDs [2,0,2].

3 / 8

Read the resulting vectors

[-0.9, 1.2]
[ 1.3,-0.1]
[-1.2, 1.4]

Elementwise addition preserves width D. Concatenation would produce width 2D.

4 / 8

Predict repeated-row gradients

Diagnostic loss: sum every combined output scalar.

Gradients: E[0]=[1,1], E[1]=[0,0], E[2]=[2,2].

Each used position row gets [1,1]. Explain the factor of two.

5 / 8

Distinguish equivariance

Unmasked attention without position signals reorders outputs when inputs reorder: permutation equivariance.

It does not leave the whole output unchanged.

A fixed causal mask changes the symmetry; explicit positions still supply an address.

6 / 8

Know what the table does not promise

Random lookup rows do not begin with semantic geometry.

Learning depends on the objective. Learned absolute positions do not automatically extend beyond Tmax.

A concatenating MLP gets order from its input slots.

7 / 8

Reconstruct the invariants

For V=5, D=4, Tmax=8: 52 table parameters.

Test shared scalar identity, repeated-ID gradient accumulation, unused-row zeros, and matching widths.

Only lookup paths are covered by the sparse-gradient claim.

8 / 8
←/→ or click edges to navigate · ? help · N notes · F fullscreen