Update README.md
Browse files
README.md
CHANGED
|
@@ -1,25 +1,63 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Synapse-Base Inference API
|
| 3 |
-
emoji: π§
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned:
|
| 8 |
-
license: cc-by-nc-4.0
|
| 9 |
-
---
|
| 10 |
|
| 11 |
# π§ Synapse-Base Inference API
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
- **
|
| 19 |
-
- **
|
| 20 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
### `POST /get-move`
|
| 25 |
|
|
@@ -27,7 +65,7 @@ High-performance chess move prediction API powered by Synapse-Base v3.0.
|
|
| 27 |
```json
|
| 28 |
{
|
| 29 |
"fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
|
| 30 |
-
"depth":
|
| 31 |
"time_limit": 5000
|
| 32 |
}
|
| 33 |
```
|
|
@@ -37,35 +75,97 @@ High-performance chess move prediction API powered by Synapse-Base v3.0.
|
|
| 37 |
{
|
| 38 |
"best_move": "e2e4",
|
| 39 |
"evaluation": 0.25,
|
| 40 |
-
"depth_searched":
|
| 41 |
-
"
|
| 42 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
```
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
## π§ Parameters
|
| 47 |
|
| 48 |
-
- **fen** (required):
|
| 49 |
-
- **depth** (optional): Search depth (1-
|
| 50 |
-
- **time_limit** (optional): Max time in milliseconds (default: 5000)
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
```
|
| 58 |
|
| 59 |
-
##
|
| 60 |
|
| 61 |
-
|
| 62 |
-
- **Memory Usage**: ~4GB RAM
|
| 63 |
-
- **Concurrent Requests**: Up to 4 simultaneous
|
| 64 |
|
| 65 |
-
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
---
|
| 70 |
|
| 71 |
-
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Synapse-Base Inference API
|
| 3 |
+
emoji: π§
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: cc-by-nc-4.0
|
| 9 |
+
---
|
| 10 |
|
| 11 |
# π§ Synapse-Base Inference API
|
| 12 |
|
| 13 |
+
State-of-the-art chess move prediction powered by Synapse-Base v3.0.
|
| 14 |
+
|
| 15 |
+
[](https://huggingface.co/GambitFlow/Synapse-Base)
|
| 16 |
+
[](https://huggingface.co/GambitFlow/Synapse-Base)
|
| 17 |
+
[](https://huggingface.co/GambitFlow/Synapse-Base)
|
| 18 |
+
|
| 19 |
+
## π― Model Details
|
| 20 |
+
|
| 21 |
+
**Synapse-Base** is a hybrid CNN-Transformer chess engine implementing research-grade search techniques:
|
| 22 |
+
|
| 23 |
+
- **Model:** [GambitFlow/Synapse-Base](https://huggingface.co/GambitFlow/Synapse-Base)
|
| 24 |
+
- **Parameters:** 38.1 Million
|
| 25 |
+
- **Architecture:** Hybrid CNN (ResNet) + Transformer (4 layers)
|
| 26 |
+
- **Input:** 119-channel board representation
|
| 27 |
+
- **Training Data:** [GambitFlow/Elite-Data](https://huggingface.co/datasets/GambitFlow/Elite-Data) (5M+ positions, 2000+ ELO)
|
| 28 |
+
- **Strength:** 2400-2600 ELO estimated
|
| 29 |
+
|
| 30 |
+
## π¬ Search Algorithm
|
| 31 |
+
|
| 32 |
+
Implements state-of-the-art techniques from chess engine research:
|
| 33 |
|
| 34 |
+
### Core Algorithms
|
| 35 |
+
- **Principal Variation Search (PVS)** [^1] - Enhanced alpha-beta with null-window searches
|
| 36 |
+
- **Null Move Pruning** [^2] - Skip opponent moves for faster deep search
|
| 37 |
+
- **Late Move Reductions (LMR)** [^3] - Reduce depth for unlikely moves
|
| 38 |
+
- **Aspiration Windows** [^4] - Focused search around expected score
|
| 39 |
|
| 40 |
+
### Optimization Techniques
|
| 41 |
+
- **Transposition Table with Zobrist Hashing** [^5] - 256MB cache with 64-bit keys
|
| 42 |
+
- **Advanced Move Ordering** [^6]:
|
| 43 |
+
- TT Move (from previous searches)
|
| 44 |
+
- MVV-LVA (Most Valuable Victim - Least Valuable Attacker)
|
| 45 |
+
- Killer Moves (quiet moves causing cutoffs)
|
| 46 |
+
- History Heuristic (move success tracking)
|
| 47 |
+
- Counter Moves (refutation table)
|
| 48 |
+
- **Quiescence Search** [^7] - Resolve tactical sequences
|
| 49 |
+
- **Iterative Deepening** [^8] - Progressive depth increase
|
| 50 |
|
| 51 |
+
## π Performance
|
| 52 |
+
|
| 53 |
+
| Metric | Value | Test Set |
|
| 54 |
+
|--------|-------|----------|
|
| 55 |
+
| **Depth 5 Search** | ~2 seconds | Standard positions |
|
| 56 |
+
| **NPS** | 50K-100K nodes/sec | T4 GPU equivalent |
|
| 57 |
+
| **Memory Usage** | ~5GB RAM | Peak inference |
|
| 58 |
+
| **TT Hit Rate** | 60-80% | Typical positions |
|
| 59 |
+
|
| 60 |
+
## π‘ API Endpoints
|
| 61 |
|
| 62 |
### `POST /get-move`
|
| 63 |
|
|
|
|
| 65 |
```json
|
| 66 |
{
|
| 67 |
"fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
|
| 68 |
+
"depth": 5,
|
| 69 |
"time_limit": 5000
|
| 70 |
}
|
| 71 |
```
|
|
|
|
| 75 |
{
|
| 76 |
"best_move": "e2e4",
|
| 77 |
"evaluation": 0.25,
|
| 78 |
+
"depth_searched": 5,
|
| 79 |
+
"seldepth": 12,
|
| 80 |
+
"nodes_evaluated": 87543,
|
| 81 |
+
"time_taken": 1847,
|
| 82 |
+
"nps": 47392,
|
| 83 |
+
"pv": ["e2e4", "e7e5", "g1f3"],
|
| 84 |
+
"tt_hit_rate": 68.4
|
| 85 |
}
|
| 86 |
```
|
| 87 |
|
| 88 |
+
### `GET /health`
|
| 89 |
+
|
| 90 |
+
Health check endpoint.
|
| 91 |
+
|
| 92 |
## π§ Parameters
|
| 93 |
|
| 94 |
+
- **fen** (required): Board position in FEN notation
|
| 95 |
+
- **depth** (optional): Search depth (1-10, default: 5)
|
| 96 |
+
- **time_limit** (optional): Max time in milliseconds (1000-30000, default: 5000)
|
| 97 |
+
|
| 98 |
+
## π Quick Start
|
| 99 |
|
| 100 |
+
```python
|
| 101 |
+
import requests
|
| 102 |
|
| 103 |
+
response = requests.post(
|
| 104 |
+
"https://YOUR-SPACE.hf.space/get-move",
|
| 105 |
+
json={
|
| 106 |
+
"fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
|
| 107 |
+
"depth": 5
|
| 108 |
+
}
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
data = response.json()
|
| 112 |
+
print(f"Best move: {data['best_move']}")
|
| 113 |
+
print(f"Evaluation: {data['evaluation']}")
|
| 114 |
```
|
| 115 |
|
| 116 |
+
## π Research References
|
| 117 |
|
| 118 |
+
[^1]: **Principal Variation Search**: Marsland, T. A. (1986). "A Review of Game-Tree Pruning". *ICCA Journal*, 9(1), 3-19.
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
[^2]: **Null Move Pruning**: Goetsch, G., & Campbell, M. S. (1990). "Experiments with the null-move heuristic". *Computers, Chess, and Cognition*, 159-168.
|
| 121 |
|
| 122 |
+
[^3]: **Late Move Reductions**: Heinz, E. A. (2000). "Adaptive null-move pruning". *ICGA Journal*, 23(3), 123-134.
|
| 123 |
+
|
| 124 |
+
[^4]: **Aspiration Windows**: Campbell, M., Hoane Jr, A. J., & Hsu, F. H. (2002). "Deep Blue". *Artificial Intelligence*, 134(1-2), 57-83.
|
| 125 |
+
|
| 126 |
+
[^5]: **Zobrist Hashing**: Zobrist, A. L. (1970). "A new hashing method with application for game playing". *ICCA Journal*, 13(2), 69-73.
|
| 127 |
+
|
| 128 |
+
[^6]: **Move Ordering**: Stockfish Team (2023). "Stockfish Chess Engine". https://github.com/official-stockfish/Stockfish
|
| 129 |
+
|
| 130 |
+
[^7]: **Quiescence Search**: Shannon, C. E. (1950). "Programming a computer for playing chess". *Philosophical Magazine*, 41(314), 256-275.
|
| 131 |
+
|
| 132 |
+
[^8]: **Iterative Deepening**: Korf, R. E. (1985). "Depth-first iterative-deepening: An optimal admissible tree search". *Artificial Intelligence*, 27(1), 97-109.
|
| 133 |
+
|
| 134 |
+
## π Additional Resources
|
| 135 |
+
|
| 136 |
+
- **AlphaZero**: Silver, D., et al. (2018). "A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play". *Science*, 362(6419), 1140-1144.
|
| 137 |
+
- **Leela Chess Zero**: https://lczero.org/
|
| 138 |
+
- **Stockfish NNUE**: Nasu, Y. (2020). "Efficiently Updatable Neural Network for Computer Shogi". *The 28th Game Programming Workshop*.
|
| 139 |
+
|
| 140 |
+
## β οΈ Limitations
|
| 141 |
+
|
| 142 |
+
- Not optimized for endgames with 7+ pieces (no tablebase integration yet)
|
| 143 |
+
- Time management assumes stable network latency
|
| 144 |
+
- Commercial use restricted under CC BY-NC 4.0
|
| 145 |
+
|
| 146 |
+
## π Model Lineage
|
| 147 |
+
|
| 148 |
+
**GambitFlow AI Engine Series:**
|
| 149 |
+
1. Nexus-Nano (2.8M) - Ultra-fast baseline
|
| 150 |
+
2. Nexus-Core (13M) - Balanced performance
|
| 151 |
+
3. **Synapse-Base (38.1M)** - State-of-the-art β¨
|
| 152 |
+
|
| 153 |
+
---
|
| 154 |
+
|
| 155 |
+
**Developed by:** [GambitFlow](https://huggingface.co/GambitFlow) / Rafsan1711
|
| 156 |
+
**License:** CC BY-NC 4.0
|
| 157 |
+
**Citation:** If you use this model in research, please cite the GambitFlow repository.
|
| 158 |
+
|
| 159 |
+
```bibtex
|
| 160 |
+
@software{gambitflow_synapse_base_2025,
|
| 161 |
+
author = {Rafsan1711},
|
| 162 |
+
title = {Synapse-Base: Hybrid CNN-Transformer Chess Engine},
|
| 163 |
+
year = {2025},
|
| 164 |
+
publisher = {Hugging Face},
|
| 165 |
+
url = {https://huggingface.co/GambitFlow/Synapse-Base}
|
| 166 |
+
}
|
| 167 |
+
```
|
| 168 |
|
| 169 |
---
|
| 170 |
|
| 171 |
+
Part of the **GambitFlow Project** πβοΈ
|