Downloads · 30 days
531
12% of all-time downloads
NAKSTStudio/chess-gemma-commentary
chess-gemma-commentary is a machine learning model from NAKSTStudio. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as gemma.
<br Fine-tuned <strongGemma 3 270M</strong model for generating chess move commentary, ELO predictions, and move classifications in <strong14 languages</strong. Includes an optional .task file for lightweight mobile i…
Downloads · 30 days
531
12% of all-time downloads
All-time downloads
4.4K
Public
Parameters
268M
3.4 GB on disk
Likes
10
Public
Click a slice to open those files.
.gguf1.9 GB · 66%
How the weights are stored.
F16268M · 100%
From the Hugging Face model README
Help us keep building free, privacy-focused chess tools! Support teen developers creating amazing apps without ads or data collection. Vote for what we build next!
</div>✅ Chess Move Commentary - Detailed analysis of chess positions and moves
✅ ELO Prediction - Estimates player skill rating (1000-2800)
✅ Move Classification - Labels moves as Best Move, Good Move, Blunder, etc.
✅ Multilingual Support - Generate commentary in 14 different languages
✅ Mobile Ready - Works on Android with flutter_gemma or Ollama
✅ Offline - No internet required for inference
| Language Code | Language Name | Native Name |
|---|---|---|
en | English | English |
hi | Hindi | हिन्दी |
es | Spanish | Español |
zh | Mandarin Chinese | 中文 |
fr | French | Français |
de | German | Deutsch |
pt | Portuguese | Português |
ru | Russian | Русский |
ja | Japanese | 日本語 |
ar | Arabic | العربية |
ko | Korean | 한국어 |
tr | Turkish | Türkçe |
id | Indonesian | Bahasa Indonesia |
bn | Bengali | বাংলা |
The model uses a conversational format with system and user messages. The input expects a JSON-like structure with role-based messages.
{
'role': 'system',
'content': 'Generate professional chess commentary in the specified language. For Type=standard use 30–40 words. For Type=explanation, explain the best move briefly (≤50 words). Return exactly: Commentary, Predicted ELO, Verified Classification.'
}
{
'role': 'user',
'content': '''LanguageL: English
LangCode: en
Type: standard
FEN: rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1
MoveSAN: Nf6
Side: Black
Actor: human
Name: John
Gender: male
Tag: Book
BestAlt: g8f6
CP: 27->21 (Δ=6)'''
}
| Field | Type | Required | Example | Explanation |
|---|---|---|---|---|
| LanguageL | string | ✅ REQUIRED | English, Hindi, Spanish | Full language name for commentary generation |
| LangCode | string | ✅ REQUIRED | en, hi, es | ISO 639-1 language code (see table above) |
| Type | string | ✅ REQUIRED | standard, explanation | Commentary type: standard (30-40 words) or explanation (explain best move, ≤50 words) |
| FEN | string | ✅ REQUIRED | rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1 | Forsyth-Edwards Notation - exact chess position before the move |
| MoveSAN | string | ✅ REQUIRED | Nf6, e4, O-O | Standard Algebraic Notation - the move that was played |
| Side | string | ✅ REQUIRED | White, Black | Which side played the move |
| Actor | string | ✅ REQUIRED | human, bot | Whether move was made by human or engine |
| NAME | string | OPTIONAL | Name of human or bot | Human or bot gender who played the move for personalized commentary |
| Gender | string | OPTIONAL | male, female, neutral | Player or bot gender for personalized commentary |
| Tag | string | ✅ REQUIRED | Book, Best, Good, Inaccuracy, Mistake, Blunder, Brilliant | Move classification tag |
| BestAlt | string | ✅ REQUIRED | g8f6, e2e4 | Best alternative move in coordinate notation |
| CP | string | ✅ REQUIRED | 27->21 (Δ=6) | Centipawn evaluation: before->after (Delta=change). Format: CPBefore->CPAfter (Δ=change) |
Input:
[
{
'role': 'system',
'content': 'Generate professional chess commentary in the specified language. For Type=standard use 30–40 words. For Type=explanation, explain the best move briefly (≤50 words). Return exactly: Commentary, Predicted ELO, Verified Classification.'
},
{
'role': 'user',
'content': '''LanguageL: English
LangCode: en
Type: standard
FEN: rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1
MoveSAN: Nf6
Side: Black
Actor: human
Gender: male
Tag: Book
BestAlt: g8f6
CP: 27->21 (Δ=6)'''
}
]
Output:
Commentary: Excellent opening response! Nf6 is the classical development move against d4. It immediately challenges the center and prepares flexible piece development. This maintains the tension and gives Black excellent counterplay.
Predicted ELO: 1850
Verified Classification: Book Move
Input:
[
{
'role': 'system',
'content': 'Generate professional chess commentary in the specified language. For Type=standard use 30–40 words. For Type=explanation, explain the best move briefly (≤50 words). Return exactly: Commentary, Predicted ELO, Verified Classification.'
},
{
'role': 'user',
'content': '''LanguageL: Hindi
LangCode: hi
Type: standard
FEN: r1bqkb1r/pppp1ppp/2n2n2/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq e6 0 4
MoveSAN: Nc3
Side: White
Actor: human
Gender: female
Tag: Best
BestAlt: b1c3
CP: 42->38 (Δ=4)'''
}
]
Output:
Commentary: शानदार केंद्रीकरण! Nc3 e4 पर दबाव के साथ विकसित होता है और प्रमुख केंद्रीय वर्गों को नियंत्रित करता है। यह चाल विकास को पूरा करने की तैयारी करती है जबकि केंद्र तनाव बनाए रखती है।
Predicted ELO: 2400
Verified Classification: Best Move
Input:
[
{
'role': 'system',
'content': 'Generate professional chess commentary in the specified language. For Type=standard use 30–40 words. For Type=explanation, explain the best move briefly (≤50 words). Return exactly: Commentary, Predicted ELO, Verified Classification.'
},
{
'role': 'user',
'content': '''LanguageL: Spanish
LangCode: es
Type: explanation
FEN: 2rq1rk1/pb1nb1pp/1p6/3p1p2/3Pn3/P1N5/1PQNBPPP/R1B1R1K1 w - - 0 16
MoveSAN: f3
Side: White
Actor: human
Gender: male
Tag: Mistake
BestAlt: d2e4
CP: 23->59 (Δ=36)'''
}
]
Output:
Commentary: El movimiento f3 debilita el rey y permite contraataques tácticos. La mejor alternativa Ne4 centralizaría el caballo con amenazas activas mientras mantiene la seguridad del rey. Este error costó aproximadamente un tercio de peón en ventaja posicional.
Predicted ELO: 1650
Verified Classification: Mistake
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("NAKSTStudio/chess-gemma-commentary")
tokenizer = AutoTokenizer.from_pretrained("NAKSTStudio/chess-gemma-commentary")
# Prepare messages
messages = [
{
'role': 'system',
'content': 'Generate professional chess commentary in the specified language. For Type=standard use 30–40 words. For Type=explanation, explain the best move briefly (≤50 words). Return exactly: Commentary, Predicted ELO, Verified Classification.'
},
{
'role': 'user',
'content': '''LanguageL: English
LangCode: en
Type: standard
FEN: rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1
MoveSAN: Nf6
Side: Black
Actor: human
Gender: male
Tag: Book
BestAlt: g8f6
CP: 27->21 (Δ=6)'''
}
]
# Generate response
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
outputs = model.generate(inputs, max_new_tokens=256, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
import 'package:flutter_gemma/flutter_gemma.dart';
class ChessAnalyzer {
late InferenceModel model;
Future<void> initModel() async {
// Install model from Hugging Face (one-time operation)
await FlutterGemma.installModel(
modelType: ModelType.gemmaIt,
).fromNetwork(
'https://huggingface.co/NAKSTStudio/chess-gemma-commentary/resolve/main/model.safetensors',
).withProgress((progress) {
print('Downloading model: ${progress.percentage}%');
}).install();
// Create model instance for inference
model = await FlutterGemma.getActiveModel(
maxTokens: 256,
preferredBackend: PreferredBackend.gpu,
);
}
Future<String> analyzeMove({
required String language,
required String langCode,
required String type,
required String fen,
required String moveSAN,
required String side,
required String actor,
required String gender,
required String tag,
required String bestAlt,
required String cp,
}) async {
final chat = await model.createChat(temperature: 0.7);
// Add system message
await chat.addQueryChunk(Message.text(
text: 'Generate professional chess commentary in the specified language. For Type=standard use 30–40 words. For Type=explanation, explain the best move briefly (≤50 words). Return exactly: Commentary, Predicted ELO, Verified Classification.',
isUser: false,
));
// Add user message with chess position data
await chat.addQueryChunk(Message.text(
text: '''LanguageL: $language
LangCode: $langCode
Type: $type
FEN: $fen
MoveSAN: $moveSAN
Side: $side
Actor: $actor
Gender: $gender
Tag: $tag
BestAlt: $bestAlt
CP: $cp''',
isUser: true,
));
// Generate response
final response = await chat.generateChatResponse();
await chat.close();
if (response is TextResponse) {
return response.token;
}
return 'Error generating response';
}
Future<void> dispose() async {
await model.close();
}
}
// Usage
final analyzer = ChessAnalyzer();
// Initialize once (downloads model if not present)
await analyzer.initModel();
// Use multiple times
final result = await analyzer.analyzeMove(
language: 'English',
langCode: 'en',
type: 'standard',
fen: 'rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1',
moveSAN: 'Nf6',
side: 'Black',
actor: 'human',
gender: 'male',
tag: 'Book',
bestAlt: 'g8f6',
cp: '27->21 (Δ=6)',
);
print(result);
// Clean up when done
await analyzer.dispose();
The model generates three key components:
chess-gemma-commentary/
├── model.safetensors # Fine-tuned weights (500MB)
├── tokenizer.model # SentencePiece tokenizer
├── tokenizer.json # Tokenizer config
├── tokenizer_config.json # Tokenizer settings
├── config.json # Model architecture config
├── chat_template.jinja # Chat formatting template
├── added_tokens.json # Special tokens
└── README.md # Documentation
⚠️ Format Sensitivity: This model is trained on the EXACT format shown above. Follow field order, spacing, and field names precisely for best results.
⚠️ Language Codes: Use the correct ISO 639-1 language code from the supported languages table. Incorrect codes may produce unexpected results.
⚠️ Commentary Types:
Type=standard: Generates 30-40 word general commentaryType=explanation: Generates ≤50 word explanation focusing on why the best alternative move is superior✅ Conversational Format: The model uses a message-based format with system and user roles for better context understanding.
✅ Gender-Aware: Optionally customize commentary style based on player gender (male/female/neutral).
✅ Delta Information: The CP field format CPBefore->CPAfter (Δ=change) helps the model understand move impact.
This model is distributed under the Gemma Community License. See: https://ai.google.dev/gemma/terms
@model{chess_gemma_commentary_2025,
title={Chess Gemma Commentary: Multilingual Chess Analysis},
author={NAKST Studio},
year={2025},
howpublished={Hugging Face Hub}
}
Made with ❤️ by NAKST Studio
Last Updated: November 7, 2025