Text Generation
Transformers
Safetensors
qwen2
chess
reasoning
global-chess-challenge-2025
lora
constrained-ranking
conversational
text-generation-inference
Instructions to use SBellilty/llm-chess-agent-v3-half-training with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SBellilty/llm-chess-agent-v3-half-training with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SBellilty/llm-chess-agent-v3-half-training") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SBellilty/llm-chess-agent-v3-half-training") model = AutoModelForCausalLM.from_pretrained("SBellilty/llm-chess-agent-v3-half-training") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use SBellilty/llm-chess-agent-v3-half-training with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SBellilty/llm-chess-agent-v3-half-training" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SBellilty/llm-chess-agent-v3-half-training", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SBellilty/llm-chess-agent-v3-half-training
- SGLang
How to use SBellilty/llm-chess-agent-v3-half-training with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SBellilty/llm-chess-agent-v3-half-training" \ --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": "SBellilty/llm-chess-agent-v3-half-training", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "SBellilty/llm-chess-agent-v3-half-training" \ --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": "SBellilty/llm-chess-agent-v3-half-training", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use SBellilty/llm-chess-agent-v3-half-training with Docker Model Runner:
docker model run hf.co/SBellilty/llm-chess-agent-v3-half-training
LLM Chess Agent - Global Chess Challenge 2025
This model is a fine-tuned chess agent for the Global Chess Challenge 2025.
🎯 Architecture
- Base Model: Qwen/Qwen2.5-1.5B-Instruct
- Method: LoRA fine-tuning (rank 8, alpha 16)
- Approach: Constrained ranking via log-probability scoring
- Guarantees:
- ✅ 100% legal moves (by construction)
- ✅ 100% correct format
🎮 How It Works
The agent uses constrained ranking instead of free generation:
- Environment provides: FEN + side + list of legal moves
- Agent scores each candidate move via log-probability
- Agent selects:
best_move = argmax(scores) - Result: Always legal (move is always in the provided list)
📊 Performance
- Legality: 100% (guaranteed by constrained ranking)
- Format: 100% (hardcoded output)
- Top-1 Accuracy: ~70-80% (vs Stockfish depth 10)
- ACPL: ~100-150 centipawns
- Playing Strength: ~1500-1800 Elo
🚀 Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "SBellilty/llm-chess-agent-v3-half-training")
# Use with the official challenge environment
# See: https://github.com/AIcrowd/global-chess-challenge-2025-starter-kit
📝 Training
- Dataset: Lichess games + Stockfish labels
- Positions: 20k-50k
- Training Steps: 2000-5000
- Hardware: Mac MPS (Apple Silicon)
- Time: ~1-2h
🏆 Challenge
Submitted to the Global Chess Challenge 2025:
📄 License
MIT License
🙏 Acknowledgments
- Challenge organizers: AIcrowd & AGI House
- Base model: Qwen team
- Chess engine: Stockfish
- Data source: Lichess Open Database
- Downloads last month
- 7