Update README.md
Browse files
README.md
CHANGED
|
@@ -17,6 +17,9 @@ language:
|
|
| 17 |
pipeline_tag: reinforcement-learning
|
| 18 |
metrics:
|
| 19 |
- mse
|
|
|
|
|
|
|
|
|
|
| 20 |
---
|
| 21 |
|
| 22 |
# βοΈ GambitFlow Nexus-core (CE)
|
|
@@ -29,82 +32,80 @@ metrics:
|
|
| 29 |

|
| 30 |

|
| 31 |
-green)
|
|
|
|
| 32 |
|
| 33 |
-
[**Live Engine Demo**](https://chessmate-engine.onrender.com/) β’ [**
|
| 34 |
|
| 35 |
</div>
|
| 36 |
|
| 37 |
## π Model Overview
|
| 38 |
|
| 39 |
-
**Nexus-core CE** is the
|
| 40 |
|
| 41 |
-
It serves as the static evaluation function (
|
| 42 |
|
| 43 |
## π§ Technical Architecture
|
| 44 |
|
| 45 |
-
The model is built using a **Residual Neural Network (ResNet)** architecture, inspired by AlphaZero but optimized for web
|
| 46 |
|
|
|
|
| 47 |
| Component | Specification | Description |
|
| 48 |
| :--- | :--- | :--- |
|
| 49 |
-
| **Input Layer** | `(1, 12, 8, 8)` |
|
| 50 |
-
| **Convolutional
|
| 51 |
-
| **Residual Tower** | **10 Blocks** | A stack of 10
|
| 52 |
-
| **Value Head** | Dense /
|
| 53 |
-
| **Output** | `
|
| 54 |
-
| **
|
| 55 |
|
| 56 |
## π Training Methodology
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
### 1.
|
| 61 |
-
We
|
| 62 |
-
- **
|
| 63 |
-
- **
|
| 64 |
-
- **Volume:**
|
| 65 |
|
| 66 |
### 2. Training Protocol
|
| 67 |
-
- **
|
| 68 |
-
- **
|
| 69 |
-
|
| 70 |
-
- **Optimizer:** AdamW with Weight Decay.
|
| 71 |
-
- **Loss Function:** Mean Squared Error (MSE) comparing the model's evaluation against the actual game outcome (0, 0.5, or 1).
|
| 72 |
-
- **Gradient Accumulation:** Effective batch size of 1024 to ensure stable convergence.
|
| 73 |
|
| 74 |
-
### 3.
|
| 75 |
-
-
|
| 76 |
-
- **Constant Folding**
|
| 77 |
-
- Validated for **WebAssembly (WASM)** compatibility via `onnxruntime-web`.
|
| 78 |
|
| 79 |
-
## π»
|
| 80 |
|
| 81 |
-
|
| 82 |
|
| 83 |
```javascript
|
| 84 |
import * as ort from 'onnxruntime-web';
|
| 85 |
|
| 86 |
-
// 1.
|
| 87 |
const session = await ort.InferenceSession.create('./chess_model_v2.onnx');
|
| 88 |
|
| 89 |
-
// 2.
|
| 90 |
-
|
| 91 |
-
const inputTensor = new ort.Tensor('float32', float32Array, [1, 12, 8, 8]);
|
| 92 |
|
| 93 |
-
// 3.
|
| 94 |
const results = await session.run({ board_state: inputTensor });
|
| 95 |
-
const
|
| 96 |
|
| 97 |
-
console.log("
|
| 98 |
```
|
| 99 |
|
| 100 |
-
##
|
| 101 |
|
| 102 |
-
|
| 103 |
|
| 104 |
-
- **
|
| 105 |
-
- **
|
|
|
|
| 106 |
|
| 107 |
---
|
| 108 |
<div align="center">
|
| 109 |
-
<p>
|
| 110 |
</div>
|
|
|
|
| 17 |
pipeline_tag: reinforcement-learning
|
| 18 |
metrics:
|
| 19 |
- mse
|
| 20 |
+
model-index:
|
| 21 |
+
- name: GambitFlow Nexus-core (CE)
|
| 22 |
+
results: []
|
| 23 |
---
|
| 24 |
|
| 25 |
# βοΈ GambitFlow Nexus-core (CE)
|
|
|
|
| 32 |

|
| 33 |

|
| 34 |
-green)
|
| 35 |
+

|
| 36 |
|
| 37 |
+
[**Live Engine Demo**](https://chessmate-engine.onrender.com/) β’ [**Dataset Card**](https://huggingface.co/datasets/Rafs-an09002/gambitflow-elite-data)
|
| 38 |
|
| 39 |
</div>
|
| 40 |
|
| 41 |
## π Model Overview
|
| 42 |
|
| 43 |
+
**Nexus-core CE** (Core Edition) is the primary engine of the **GambitFlow** project. It is a deep Residual Neural Network designed to evaluate chess positions with high-level human-like intuition. Unlike traditional engines that use manual "if-then" logic, Nexus-core learned chess strategy by analyzing over **5 million positions** played by elite grandmaster-level players.
|
| 44 |
|
| 45 |
+
It serves as the static evaluation function (the "Brain") for the GambitFlow search algorithm, providing a numeric advantage score for any given board state.
|
| 46 |
|
| 47 |
## π§ Technical Architecture
|
| 48 |
|
| 49 |
+
The model is built using a **Residual Neural Network (ResNet)** architecture, inspired by the AlphaZero research but highly optimized for efficient inference in web browsers and low-power devices.
|
| 50 |
|
| 51 |
+
### Specification Table
|
| 52 |
| Component | Specification | Description |
|
| 53 |
| :--- | :--- | :--- |
|
| 54 |
+
| **Input Layer** | `(1, 12, 8, 8)` | 12-channel bitboard representation (6 for White, 6 for Black pieces). |
|
| 55 |
+
| **Convolutional Stem** | 128 Filters, 3x3 | Initial spatial feature extraction from the 8x8 grid. |
|
| 56 |
+
| **Residual Tower** | **10 Blocks** | A stack of 10 ResBlocks using Skip-Connections to prevent gradient vanishing and capture deep strategy. |
|
| 57 |
+
| **Value Head** | Dense / Tanh | Compresses 8192 high-level features into a single scalar evaluation. |
|
| 58 |
+
| **Output Range** | `[-1.0, 1.0]` | Positive favors White, negative favors Black. |
|
| 59 |
+
| **Params** | **~3.5 Million** | Balanced for high depth-to-speed ratio. |
|
| 60 |
|
| 61 |
## π Training Methodology
|
| 62 |
|
| 63 |
+
Nexus-core was trained using a professional-grade pipeline designed for robustness and strategic depth.
|
| 64 |
|
| 65 |
+
### 1. The Elite Dataset
|
| 66 |
+
We utilized the `gambitflow-elite-data` corpus:
|
| 67 |
+
- **Filtering:** Only games where **both players had ELO > 2000**.
|
| 68 |
+
- **Stage:** Focused on the first 20 moves to master opening and middlegame transition.
|
| 69 |
+
- **Volume:** ~5,000,000 unique positions.
|
| 70 |
|
| 71 |
### 2. Training Protocol
|
| 72 |
+
- **Mixed Precision:** Trained using `torch.amp` (FP16) for 2x faster convergence and memory efficiency.
|
| 73 |
+
- **Optimizer:** AdamW with a weight decay of `1e-4` to prevent overfitting.
|
| 74 |
+
- **Loss:** MSE (Mean Squared Error) between the predicted value and the actual game result.
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
+
### 3. ONNX Optimization
|
| 77 |
+
- Exported with **Opset 17**.
|
| 78 |
+
- **Constant Folding** and Graph Optimization enabled to reduce latency during real-time play.
|
|
|
|
| 79 |
|
| 80 |
+
## π» Implementation (JavaScript)
|
| 81 |
|
| 82 |
+
Designed for seamless integration with `onnxruntime-web`.
|
| 83 |
|
| 84 |
```javascript
|
| 85 |
import * as ort from 'onnxruntime-web';
|
| 86 |
|
| 87 |
+
// 1. Load the Brain
|
| 88 |
const session = await ort.InferenceSession.create('./chess_model_v2.onnx');
|
| 89 |
|
| 90 |
+
// 2. Prepare 12x8x8 Tensor (Encoded from FEN)
|
| 91 |
+
const inputTensor = new ort.Tensor('float32', boardData, [1, 12, 8, 8]);
|
|
|
|
| 92 |
|
| 93 |
+
// 3. Get Evaluation
|
| 94 |
const results = await session.run({ board_state: inputTensor });
|
| 95 |
+
const score = results.evaluation.data[0];
|
| 96 |
|
| 97 |
+
console.log("Nexus-core Evaluation:", score);
|
| 98 |
```
|
| 99 |
|
| 100 |
+
## π‘οΈ License & Ethics
|
| 101 |
|
| 102 |
+
This model is shared under the **Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)** license.
|
| 103 |
|
| 104 |
+
- **Attribution:** You must give credit to the GambitFlow project.
|
| 105 |
+
- **Non-Commercial:** This model cannot be used for commercial purposes without an explicit agreement.
|
| 106 |
+
- **Innovation:** We encourage researchers to fork and improve this model for non-commercial game-AI research.
|
| 107 |
|
| 108 |
---
|
| 109 |
<div align="center">
|
| 110 |
+
<p>Developed by <a href="https://huggingface.co/Rafs-an09002">Rafsan</a> @ GambitFlow Labs</p>
|
| 111 |
</div>
|