初始化项目,由ModelHub XC社区提供模型
Model: FlameF0X/ChessSLM Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
1000046422-01.jpeg filter=lfs diff=lfs merge=lfs -text
|
||||
111
README.md
Normal file
111
README.md
Normal file
@@ -0,0 +1,111 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
datasets:
|
||||
- mlabonne/chessllm
|
||||
library_name: transformers
|
||||
tags:
|
||||
- chess
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<img src="https://cdn-uploads.huggingface.co/production/uploads/6615494716917dfdc645c44e/IEb4W62mlcCFKom7Fd4qi.jpeg" alt="NanoRS Banner" style="width: 100%; max-width: 100%; height: auto; display: inline-block; margin-bottom: 0.5em; margin-top: 0.5em; reading-order: 20px; border-radius: 20px;"/>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
# ChessSLM
|
||||
|
||||
**ChessSLM** is a small language model designed to play chess using natural language move generation.
|
||||
Despite having only **30M parameters**, it is capable of competing with and occasionally outperforming larger language models in chess-playing tasks.
|
||||
|
||||
The model is based on the **GPT-2 architecture** and was pre-trained from scratch on **100,000 chess games** from the `mlabonne/chessllm` dataset using **SAN (Standard Algebraic Notation)**.
|
||||
|
||||
Play against ChessSLM [here](https://flamef0x.github.io/other/chess).
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
- **Architecture:** GPT-2
|
||||
- **Parameters:** ~30M
|
||||
- **Training data:** 100k chess games
|
||||
- **Notation:** SAN (Standard Algebraic Notation)
|
||||
- **Task:** Autoregressive chess move generation
|
||||
|
||||
ChessSLM demonstrates that **specialized small language models can perform competitively in narrow domains** such as chess.
|
||||
|
||||
---
|
||||
|
||||
## Capabilities
|
||||
|
||||
ChessSLM can play chess by generating moves sequentially in SAN notation.
|
||||
It has been evaluated in matches against several language models, including:
|
||||
|
||||
- Claude [Won against it]
|
||||
- Gemini [Lost again it]
|
||||
- Qwen
|
||||
- GPT-2
|
||||
- GPT-Neo
|
||||
- Pythia
|
||||
- LLaMA
|
||||
- Mistral
|
||||
- other small chess-oriented models
|
||||
|
||||
The model achieves an averaging rating of **around ~1054 Elo** against other language models despite its small size.
|
||||
|
||||
---
|
||||
|
||||
## Benchmark Results
|
||||
|
||||
| Model | Elo Rating |
|
||||
| ------------------------------ | ---------- |
|
||||
| **FlameF0X/ChessSLM** | 1154 |
|
||||
| DedeProGames/mini-chennus | 1114 |
|
||||
| EleutherAI/pythia-70m-deduped | 1099 |
|
||||
| nlpguy/smolchess-v2 | 1092 |
|
||||
| DedeProGames/dialochess | 1078 |
|
||||
| nlpguy/amdchess-v9 | 1073 |
|
||||
| mlabonne/grandpythia-200k-70m | 1065 |
|
||||
| **FlameF0X/ChessSLM-PM** | 1055 |
|
||||
| DedeProGames/Chesser-248K-Mini | 1050 |
|
||||
| bharathrajcl/chess_llama_68m | 1048 |
|
||||
| **FlameF0X/ChessSLM-RL** | 1047 |
|
||||
| distilbert/distilgpt2 | 1047 |
|
||||
| Mattimax/EliaChess-70m | 1047 |
|
||||
| HuggingFaceTB/SmolLM2-135M | 1042 |
|
||||
| nlpguy/amdchess-v5 | 1041 |
|
||||
| facebook/opt-125m | 1041 |
|
||||
| EleutherAI/pythia-14m | 1037 |
|
||||
| DedeProGames/chennus | 1034 |
|
||||
| Smilyai-labs/Smily-ultra-1 | 1034 |
|
||||
| huyvux3005/chessllm_FPT | 1034 |
|
||||
|
||||
---
|
||||
|
||||
## Limitations
|
||||
|
||||
Like many language-model-based chess systems, ChessSLM has several limitations:
|
||||
|
||||
- **Illegal move hallucinations:** The model may occasionally generate moves that violate chess rules.
|
||||
- **No board-state verification:** Moves are generated purely from learned patterns rather than a validated game state.
|
||||
- **Limited strategic depth:** While competitive at lower Elo levels, it cannot match dedicated chess engines.
|
||||
|
||||
These limitations are common for **pure language-model chess agents** that do not use external rule engines.
|
||||
|
||||
---
|
||||
|
||||
## Future Improvements
|
||||
|
||||
Potential improvements include:
|
||||
|
||||
- Adding **move legality filtering**
|
||||
- Integrating **board-state validation**
|
||||
- Training on **larger datasets**
|
||||
- Reinforcement learning through **self-play**
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
ChessSLM shows that **very small language models can achieve meaningful chess performance** when trained on domain-specific data.
|
||||
It serves as a lightweight baseline for exploring **LLM-based chess agents** and **specialized small language models (SLMs)**.
|
||||
34
config.json
Normal file
34
config.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"activation_function": "gelu_new",
|
||||
"add_cross_attention": false,
|
||||
"architectures": [
|
||||
"GPT2LMHeadModel"
|
||||
],
|
||||
"attn_pdrop": 0.1,
|
||||
"bos_token_id": 50256,
|
||||
"dtype": "float32",
|
||||
"embd_pdrop": 0.1,
|
||||
"eos_token_id": 50256,
|
||||
"initializer_range": 0.02,
|
||||
"layer_norm_epsilon": 1e-05,
|
||||
"model_type": "gpt2",
|
||||
"n_embd": 384,
|
||||
"n_head": 6,
|
||||
"n_inner": null,
|
||||
"n_layer": 6,
|
||||
"n_positions": 1024,
|
||||
"pad_token_id": null,
|
||||
"reorder_and_upcast_attn": false,
|
||||
"resid_pdrop": 0.1,
|
||||
"scale_attn_by_inverse_layer_idx": false,
|
||||
"scale_attn_weights": true,
|
||||
"summary_activation": null,
|
||||
"summary_first_dropout": 0.1,
|
||||
"summary_proj_to_labels": true,
|
||||
"summary_type": "cls_index",
|
||||
"summary_use_proj": true,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "5.0.0",
|
||||
"use_cache": false,
|
||||
"vocab_size": 50257
|
||||
}
|
||||
9
generation_config.json
Normal file
9
generation_config.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 50256,
|
||||
"eos_token_id": 50256,
|
||||
"output_attentions": false,
|
||||
"output_hidden_states": false,
|
||||
"transformers_version": "5.0.0",
|
||||
"use_cache": false
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:24fed4bbf984a7bb3a9091c60af2e75fd16dee79d4c968ae1857265d612dfc68
|
||||
size 121365368
|
||||
3
optimizer.pt
Normal file
3
optimizer.pt
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b19af4422ec94a19d5ed141d33c050907960b2335d4abdc7085e2cbba58a84f9
|
||||
size 242779979
|
||||
3
rng_state.pth
Normal file
3
rng_state.pth
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ff2fb1898075ad62bfeb88efd6f458e72d970011ce835a951d417d70395e61d6
|
||||
size 14645
|
||||
3
scaler.pt
Normal file
3
scaler.pt
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:14ae2a2128444abab378aa06c09a61a84665f758fcc19fc46f5789b0bc1b5665
|
||||
size 1383
|
||||
3
scheduler.pt
Normal file
3
scheduler.pt
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d383d9981af3af3a4b738ded756a0ac8f2c9578645c7dcaa1743590117bcebb5
|
||||
size 1465
|
||||
250320
tokenizer.json
Normal file
250320
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
12
tokenizer_config.json
Normal file
12
tokenizer_config.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"add_prefix_space": false,
|
||||
"backend": "tokenizers",
|
||||
"bos_token": "<|endoftext|>",
|
||||
"eos_token": "<|endoftext|>",
|
||||
"errors": "replace",
|
||||
"is_local": false,
|
||||
"model_max_length": 1024,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"tokenizer_class": "GPT2Tokenizer",
|
||||
"unk_token": "<|endoftext|>"
|
||||
}
|
||||
104
trainer_state.json
Normal file
104
trainer_state.json
Normal file
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"best_global_step": null,
|
||||
"best_metric": null,
|
||||
"best_model_checkpoint": null,
|
||||
"epoch": 0.32,
|
||||
"eval_steps": 500,
|
||||
"global_step": 1000,
|
||||
"is_hyper_param_search": false,
|
||||
"is_local_process_zero": true,
|
||||
"is_world_process_zero": true,
|
||||
"log_history": [
|
||||
{
|
||||
"epoch": 0.032,
|
||||
"grad_norm": 3.0811734199523926,
|
||||
"learning_rate": 9.900000000000001e-05,
|
||||
"loss": 8.391141967773438,
|
||||
"step": 100
|
||||
},
|
||||
{
|
||||
"epoch": 0.064,
|
||||
"grad_norm": 0.9263819456100464,
|
||||
"learning_rate": 0.000199,
|
||||
"loss": 3.055461730957031,
|
||||
"step": 200
|
||||
},
|
||||
{
|
||||
"epoch": 0.096,
|
||||
"grad_norm": 0.9063050150871277,
|
||||
"learning_rate": 0.000299,
|
||||
"loss": 1.9104501342773437,
|
||||
"step": 300
|
||||
},
|
||||
{
|
||||
"epoch": 0.128,
|
||||
"grad_norm": 1.318272352218628,
|
||||
"learning_rate": 0.00039900000000000005,
|
||||
"loss": 1.6620086669921874,
|
||||
"step": 400
|
||||
},
|
||||
{
|
||||
"epoch": 0.16,
|
||||
"grad_norm": 0.7002186179161072,
|
||||
"learning_rate": 0.000499,
|
||||
"loss": 1.5271978759765625,
|
||||
"step": 500
|
||||
},
|
||||
{
|
||||
"epoch": 0.192,
|
||||
"grad_norm": 0.6296432018280029,
|
||||
"learning_rate": 0.0004999682018599242,
|
||||
"loss": 1.4492141723632812,
|
||||
"step": 600
|
||||
},
|
||||
{
|
||||
"epoch": 0.224,
|
||||
"grad_norm": 0.6575325131416321,
|
||||
"learning_rate": 0.0004998715277031906,
|
||||
"loss": 1.3877157592773437,
|
||||
"step": 700
|
||||
},
|
||||
{
|
||||
"epoch": 0.256,
|
||||
"grad_norm": 0.4923152029514313,
|
||||
"learning_rate": 0.0004997099993771365,
|
||||
"loss": 1.3457301330566407,
|
||||
"step": 800
|
||||
},
|
||||
{
|
||||
"epoch": 0.288,
|
||||
"grad_norm": 0.5497189164161682,
|
||||
"learning_rate": 0.000499483658806448,
|
||||
"loss": 1.305233154296875,
|
||||
"step": 900
|
||||
},
|
||||
{
|
||||
"epoch": 0.32,
|
||||
"grad_norm": 0.5527522563934326,
|
||||
"learning_rate": 0.0004991925647378331,
|
||||
"loss": 1.2742790222167968,
|
||||
"step": 1000
|
||||
}
|
||||
],
|
||||
"logging_steps": 100,
|
||||
"max_steps": 20000,
|
||||
"num_input_tokens_seen": 0,
|
||||
"num_train_epochs": 7,
|
||||
"save_steps": 1000,
|
||||
"stateful_callbacks": {
|
||||
"TrainerControl": {
|
||||
"args": {
|
||||
"should_epoch_stop": false,
|
||||
"should_evaluate": false,
|
||||
"should_log": false,
|
||||
"should_save": true,
|
||||
"should_training_stop": false
|
||||
},
|
||||
"attributes": {}
|
||||
}
|
||||
},
|
||||
"total_flos": 1046696951808000.0,
|
||||
"train_batch_size": 2,
|
||||
"trial_name": null,
|
||||
"trial_params": null
|
||||
}
|
||||
3
training_args.bin
Normal file
3
training_args.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8910b6b094f53128fbaeee720374f96af92a753b312f2d444f44d6ab8e396302
|
||||
size 5137
|
||||
Reference in New Issue
Block a user