Instructions to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged") model = AutoModelForCausalLM.from_pretrained("felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged", 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]:])) - MLX
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged
- SGLang
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged 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 "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged" \ --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": "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged", "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 "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged" \ --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": "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Pi
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged
Run Hermes
hermes
- OpenClaw new
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged with Docker Model Runner:
docker model run hf.co/felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged
Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged
A merged chess puzzle explanation model — ready to use without adapters!
This is a fully merged version of Qwen3-4B-Lichess-Chess-Puzzle-Tutor, with the LoRA adapter weights fused directly into the base model. No need for PEFT or adapter loading — just load and go!
🎯 Model Overview
- Base Model: Qwen/Qwen3-4B-Instruct-2507
- Fine-tuning: LoRA adapter trained on 5,020 Lichess puzzles
- Format: Merged (base + adapter fused)
- Best Checkpoint: Iteration 3900 (validation loss: 0.596)
- Framework: Compatible with transformers, MLX, llama.cpp
📊 Training Details
- Training Data: 5,020 high-quality Lichess chess puzzles with Claude-generated explanations
- LoRA Config: rank=32, alpha=64
- Training Iterations: 6,000 (best @ 3900)
- Batch Size: 4
- Learning Rate: 3e-5
- Quality Metrics: 96% completeness, avg 659 chars/explanation
🚀 Quick Start
Using Transformers
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged"
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
)
# Example puzzle
puzzle = """Explain this chess puzzle:
Position (FEN): r1bqkb1r/pppp1ppp/2n2n2/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 4 4
Solution: Nxe5 Nxe5 d4
Themes: fork pin
Rating: 1500"""
# Generate explanation
messages = [{"role": "user", "content": puzzle}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
Using MLX (Apple Silicon)
from mlx_lm import load, generate
# Note: This merged model is in HuggingFace format
# For MLX, use the MLX-format version or the original adapter
model, tokenizer = load("felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged")
prompt = """Explain this chess puzzle:
Position (FEN): r1bqkb1r/pppp1ppp/2n2n2/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 4 4
Solution: Nxe5 Nxe5 d4
Themes: fork pin
Rating: 1500"""
response = generate(model, tokenizer, prompt=prompt, max_tokens=512)
print(response)
💡 Why Use the Merged Version?
✅ Simpler deployment — No adapter loading, no PEFT dependencies
✅ Faster startup — Single model file, no merging at runtime
✅ Gradio/Spaces friendly — Works with standard transformers
✅ GGUF conversion — Easier conversion for llama.cpp
📚 Training Data
Data Source
- Puzzles: Lichess puzzle database (CC0 1.0 Universal)
- Explanations: Generated using Claude API (Anthropic)
- Size: 5,020 training + 502 validation puzzles
Data Quality
Puzzles filtered for:
- Popularity ≥ 90th percentile
- Rating deviation ≤ 80 (consistent difficulty)
- Minimum plays ≥ 500
- Balanced across tactical themes (fork, pin, skewer, discovered attack, mate patterns, sacrifice, deflection, etc.)
Explanations generated using Claude API with consistent prompting for educational quality, focusing on:
- Clear explanation of the tactical pattern
- Step-by-step move analysis
- Why alternatives don't work
- Key learning points
Coverage
- Rating Range: 1000-2500
- Themes: 20+ tactical patterns
- Format: FEN position + UCI solution + themes + rating → educational explanation
🎓 Intended Use
✅ Recommended
- Educational chess puzzle explanations
- Learning tactical patterns
- Automated puzzle commentary
- Interactive chess tutoring systems
❌ Not Recommended
- Full game analysis (puzzle-focused only)
- Opening theory (not in training data)
- Endgame tablebase analysis
🔄 Differences from Base Adapter Model
| Feature | Adapter Version | Merged Version (this) |
|---|---|---|
| Format | LoRA adapter only | Full model (base + adapter) |
| Size | ~150MB | ~8GB |
| Loading | Requires base + PEFT | Direct transformers load |
| Use Case | MLX, custom training | Deployment, Spaces, inference |
🌐 Live Demo
Try it live: Chess Puzzle Tutor Space
📝 Citation
@software{qwen3_chess_tutor_merged_2025,
author = {Felix Manojh},
title = {Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged},
year = {2025},
url = {https://huggingface.co/felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged},
note = {Merged model fine-tuned on Lichess puzzle database with Claude-generated explanations}
}
📄 License
- Model: Apache 2.0
- Puzzle Data: Lichess puzzle database (CC0 1.0 Universal)
- Explanations: Generated using Claude API for training purposes
🙏 Acknowledgments
- Lichess for the comprehensive puzzle database
- Anthropic for Claude API used to generate training explanations
- Qwen Team for the excellent Qwen3-4B base model
- Apple MLX Team for the MLX framework
Related Models:
- Qwen3-4B-Lichess-Chess-Puzzle-Tutor - LoRA adapter version
- Qwen3-4B-Chess-Puzzle-Tutor-Fused-MLX - MLX format
- Downloads last month
- 10
Quantized
Model tree for felixmanojh/Qwen3-4B-Lichess-Chess-Puzzle-Tutor-Merged
Base model
Qwen/Qwen3-4B-Instruct-2507