|
io-chess
UCI chess engine
|
Feature extraction is the most computationally intensive part of the preprocessing pipeline. Each chess position is encoded into a set of spatial feature planes (8×8 grids) and scalar features that together capture the essential information about the position.
The FactorizedFeatureExtractor computes the current feature set used by the Factorized MoE network. Features are grouped into categories:
Twelve binary 8×8 planes (one per piece type and colour) encoding the presence of each piece on each square. These are the most basic input features and provide the foundation for all other computations.
Distance metrics between key squares, computed using Chebyshev distance (the number of king moves required to travel between two squares):
Pawn-specific structural features computed from the pawn bitboards:
| Feature | Description |
|---|---|
| Passed pawns | Pawns with no opposing pawns ahead on the same or adjacent files |
| Backward pawns | Pawns that cannot advance without being captured and have no friendly pawn support |
| Isolated pawns | Pawns with no friendly pawns on adjacent files |
| Doubled pawns | Multiple pawns of the same colour on the same file |
| Front-span maps | The set of squares ahead of each pawn, encoding pawn chains and pawn breaks |
Attack and pin ray maps for sliding pieces (bishops, rooks, queens) relative to the kings:
The ExpertRouter classifies each position into one of four categories that correspond to the MoE experts. These labels are used during Phase 2 (Router Warm-Up) and Phase 3 (Expert Specialisation) of training:
| Category | Heuristic |
|---|---|
| Tactical | High capture/check potential, queen present, threats |
| Strategical | Middlegame with stable pawn structure, no immediate tactics |
| Major endgame | ≤ 1 minor piece per side, rook or queen present |
| Minor endgame | Only minor pieces and pawns remain |
The older FeatureExtractor uses a simpler set of input features (piece-only planes without distance maps or pawn structure) and produces a different binary layout. It is retained for backward compatibility with v1 model weights and is not used by the current training pipeline.