File size: 5,879 Bytes
6c1c5f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
784e002
6c1c5f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
language: 
- en
tags:
- chess
- reinforcement-learning
- resnet
- transformer
- gambitflow
- synapse-edge
license: cc-by-nc-4.0
library_name: onnx
metrics:
- accuracy
- mse
pipeline_tag: zero-shot-classification
---

# ♟️ GambitFlow Synapse-Edge v1 (Flagship)

<div align="center">

![GambitFlow Banner](https://capsule-render.vercel.app/api?type=waving&color=0:2c3e50,100:000000&height=200&section=header&text=Synapse-Edge%20v1&fontSize=50&animation=fadeIn&fontAlignY=35&desc=Next-Gen%20Hybrid%20Chess%20Intelligence&descAlignY=60)

[![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc/4.0/)
![Architecture](https://img.shields.io/badge/Architecture-Hybrid%20ResNet--Transformer-orange)
![Parameters](https://img.shields.io/badge/Params-~16.5M-blue)
![Format](https://img.shields.io/badge/Format-ONNX%20(Opset%2017)-green)
![Status](https://img.shields.io/badge/Status-Flagship%20Release-red)

[**Dataset Hub**](https://huggingface.co/datasets/GambitFlow/Synapse-Edge-Data) •  [**Community Support**](https://huggingface.co/Rafs-an09002)

</div>

## 🌟 Model Overview

**Synapse-Edge v1** is the definitive flagship chess AI from **GambitFlow**. Representing the pinnacle of our Gen-3 research, it shatters the limitations of pure convolutional models by introducing a massive **Hybrid ResNet-Transformer architecture**. 

While previous models like *Nexus-Core* excelled at recognizing spatial patterns, Synapse-Edge v1 masters **long-range tactical dependencies** and **strategic sequencing**, making it our most "human-like" yet superhumanly sharp engine to date.

---

## 🏗️ Technical Architecture

The model utilizes a sophisticated multi-stage processing pipeline:

### 1. The Input: 119-Channel Rich Feature Map
Instead of a simple 12-channel board state, Synapse-Edge v1 processes **119 discrete information layers** per position:
- **Piece Occupancy (12):** Fundamental bitboards for all pieces.
- **Attack Influence Maps (12):** Explicit spatial "heatmaps" of which squares are under fire.
- **Auxiliary Metadata (95):** Castling rights, side to move, check status, en passant targets, and board history.

### 2. The Backbone: SE-ResNet-20
- **20 Residual Blocks** ensure deep feature extraction.
- **Squeeze-and-Excitation (SE) Attention** modules in every block allow the network to dynamically recalibrate piece importance based on the position.

### 3. The Neck: Transformer Sequence Fusion
- **4 Transformer Layers** process the board as a 64-square sequence.
- This allows the model to understand **tactical causality** (e.g., *"If I move here, the pinned knight will be attacked 3 moves later"*).

### 4. Multi-Head Prediction System
The model doesn't just evaluate; it understands the game through four specialized heads:
- **Policy Head:** Predicts the most likely master-level move from **4,672 possible UCI combinations**.
- **Value Head:** Provides a rock-solid evaluation in the range **[-1, +1]**.
- **Tactical Head:** A binary classifier that flags **"Sharpness"** (detects Forks, Pins, and Skewers instantly).
- **Phase Head:** Dynamically identifies game phases (**Opening, Middlegame, Endgame**) to adjust playing style.

---

## 📊 Training Details

### Distributed 4-Worker Sharding
Synapse-Edge v1 was trained using a **High-Efficiency Distributed Pipeline**:
- **Dataset:** Over **5.5 million elite positional samples** (Elo 2000+) + **3 million tactical puzzles**.
- **Execution:** The database was split into 4 shards and trained simultaneously across 4 independent Google Colab instances.
- **Synthesis:** The final model is a **Synchronized Ensemble** where weights from all four shards were merged and averaged to create a "Master Brain" with collective knowledge.

| Specification | Value |
| :--- | :--- |
| **Total Parameters** | 16,494,757 |
| **Total Samples** | 8.5 Million |
| **Training Device** | 4x Tesla T4 GPUs (Distributed) |
| **Optimizer** | AdamW (1e-4) |
| **Precision** | Mixed (FP16/FP32) |

---

## 🚀 Usage & Implementation

The model is exported in **ONNX (Opset 17)** for maximum cross-platform compatibility.

### Quick Start with Python
```python
import onnxruntime as ort
import numpy as np

# Initialize the flagship engine
session = ort.InferenceSession("synapse_edge_v1.onnx")

# Prepare your input (119 channels)
# dummy_input = np.random.randn(1, 119, 8, 8).astype(np.float32)

# Run Multi-Head Inference
policy, value, tactical, phase = session.run(None, {"input": dummy_input})

print(f"Value Score: {value[0][0]}")
print(f"Tactical Sharpness: {tactical[0][0]}")
```

---

## 🛣️ Roadmap: The Path to Superhuman Strength

Synapse-Edge v1 is not a finished product, but the beginning of a **Continuous Development Pipeline**:

1.  **v1 (Current):** Master-level baseline trained on master games and puzzles.
2.  **v1.1 - v1.5:** Iterative fine-tuning on refined elite datasets.
3.  **v2 (Self-Play):** The model will play against itself for weeks, generating "Alien Strategies" to surpass human theory.
4.  **v3 (Final Flagship):** Full Reinforcement Learning (RL) integration aiming for **3500+ Elo**.

---

## 🛡️ Limitations & Bias
- **Inference Latency:** Due to the Transformer layers, inference on CPU is slower than Nexus-Core (~100-300ms per position). For optimal performance, use GPU-based ONNX Runtime.
- **Endgame Accuracy:** Without tablebases, very complex endgames (e.g., KBNK) may require more search depth.

## 📜 License
This model is released under the **Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)** license. Commercial use without prior permission is prohibited.

---
**Model Authors:** [Rafsan / GambitFlow](https://huggingface.co/Rafs-an09002)
**Project Mission:** Democratizing Superhuman Chess AI through Neural Innovation. 🚀♟️