← Back to Game

Neural Network Architecture

UniversalPegNet - Interactive 3D Visualisation

~3.3M
Parameters
128
Channels
10
ResNet Blocks
4
Attention Layers
1800
Actions
GELU
Activation
Drag to rotate • Scroll to zoom Swipe to rotate • Pinch to zoom • Tap layers for info
Input
Convolution
ResNet + SE
Attention
Policy
Value

Layer

Description

Shape

Architecture Components

Input Encoding (4 channels)

Board state expanded to 4 channels: invalid positions, holes, pegs, and a learned board-type embedding that adapts to different game variants.

ResNet + Squeeze-Excitation

10 residual blocks with SE attention. Each block: Conv3x3 → BN → GELU → Conv3x3 → BN → SE → DropPath. Channel attention emphasizes important features.

Multi-Head Spatial Attention

4 transformer-style attention layers with 4 heads each. Enables global reasoning about distant board positions - crucial for planning long jump sequences.

Dual Output Heads

Policy: 1800 logits (15×15×8 directions). Value: Solvability prediction [0,1] as auxiliary task to improve learned representations.

Forward Pass

The network processes a board state through the following stages:

Input: Board State [15 × 15]
↓ expand to 4 channels
[15 × 15 × 4] → Conv3x3 + BN + GELU → [15 × 15 × 128]
↓ 10× residual blocks
[15 × 15 × 128] → ResBlock+SE ×10 → [15 × 15 × 128]
↓ 4× attention layers
[15 × 15 × 128] → MultiHeadAttn ×4 → [15 × 15 × 128]
↓ split to heads
Policy Head
Conv1x1 → [15×15×64]
Conv1x1 → [15×15×8]
Output: 1800 logits
Value Head
GlobalAvgPool → [128]
FC → [64] → [1]
Output: solvability