Qwen-ChessLM
Collection
A family of chess-specific language models built by fine-tuning Qwen-3.5-2B • 2 items • Updated
How to use GL3MON/Qwen3.5-2B-chess-rl-grpo with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="GL3MON/Qwen3.5-2B-chess-rl-grpo")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("GL3MON/Qwen3.5-2B-chess-rl-grpo")
model = AutoModelForCausalLM.from_pretrained("GL3MON/Qwen3.5-2B-chess-rl-grpo", device_map="auto")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use GL3MON/Qwen3.5-2B-chess-rl-grpo with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "GL3MON/Qwen3.5-2B-chess-rl-grpo"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "GL3MON/Qwen3.5-2B-chess-rl-grpo",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/GL3MON/Qwen3.5-2B-chess-rl-grpo
How to use GL3MON/Qwen3.5-2B-chess-rl-grpo with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "GL3MON/Qwen3.5-2B-chess-rl-grpo" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "GL3MON/Qwen3.5-2B-chess-rl-grpo",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "GL3MON/Qwen3.5-2B-chess-rl-grpo" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "GL3MON/Qwen3.5-2B-chess-rl-grpo",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use GL3MON/Qwen3.5-2B-chess-rl-grpo with Docker Model Runner:
docker model run hf.co/GL3MON/Qwen3.5-2B-chess-rl-grpo
This is a fine-tuned version of Qwen-3.5-2B on chess move prediction using Group Relative Policy Optimization (GRPO) with Stockfish as the reward signal. This is an RL fine-tuned model that builds upon the SFT checkpoint.
checkpoint-5940)| Parameter | Value |
|---|---|
| Beta (KL control) | 0.1 |
| Epsilon (clip range) | 0.2 |
| Learning Rate | 1e-6 |
| Samples per prompt | 4 |
| Epochs | 1 |
The RL training was performed on a split of the ChessInstruct dataset with the following task categories:
FIND_NEXT_BEST_MOVEFIND_ADVANTAGED_PLAYERFIND_FINAL_SCOREMLM_ON_MOVESFIND_LAST_MOVESORT_FENSfrom transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_name = "GL3MON/Qwen3.5-2B-chess-rl-grpo"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Example: Generate chess moves
messages = [
{"role": "system", "content": "You are a chess assistant. Provide the best move in SAN format."},
{"role": "user", "content": "What is the best move for white in the position: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1?"}
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
outputs = model.generate(input_ids, max_new_tokens=50, temperature=0.7, do_sample=True)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
MIT License
@software{ChessLM2026,
title = {ChessLM - Qwen-3.5-2B Chess Assistant (RL GRPO)},
author = {GL3MON},
year = {2026},
url = {https://huggingface.co/GL3MON/Qwen3.5-2B-chess-rl-grpo}
}