Search the guide

Start with a guide

Lesson 12 of 14 · Use and inspect programs · Python tutorial

Read weights

Calculate a norm map and test a weight symmetry.

Inspect connections from an input#

A network’s weights contain structure you can calculate. For each input cell, take the L2 norm of its connections to the first hidden layer. A larger value means a larger connection vector. The exercise uses a small synthetic kernel so every number is visible.

Calculate the norms#

Python · NumPy
Ready to run

Output

Run the code to see its output.

Try this: Change one kernel value and run again. Then compare the maps before and after the consistent hidden-unit permutation.

Runs in your browser. Ctrl/⌘ + Enter runs the code.

Run it on a released network#

Choose a game and an input channel. Run Python to fetch the original network, calculate its norm map, and check a consistent hidden-unit permutation on 64 binary input vectors.

Python · NumPy
Ready to run

Output

Run the code to see its output.

Try this: Choose another network or channel and run again. The channels of each network share one color scale. Compare the bright cells and the permutation check.

Runs in your browser. Ctrl/⌘ + Enter runs the code.

Networks by Rikiya Takehi, Jayden Teoh, Alex Zhang and Omar Khattab. Original experiment · CC BY 4.0

Apply the calculation to released weights#

A consistent hidden-unit permutation changes the stored arrays while preserving the network’s computation. The norm map stays the same. Inspect the four released Sparks networks for actual game-policy heatmaps and the corresponding permutation checks.

Sparks also asks a general-purpose LLM to identify games from weights and input descriptions. Computing a norm map and interpreting its meaning are two different steps.

Sources and resources

Course contents