Chess Vector Engine
A production-ready Rust chess engine that revolutionizes position evaluation by combining vector-based pattern recognition with advanced tactical search. Encode positions as high-dimensional vectors, search through millions of patterns, and leverage sophisticated neural networks for cutting-edge chess AI.
๐ Features
๐ง Hybrid Intelligence
- ๐ฏ Hybrid Evaluation - Combines pattern recognition with advanced tactical search for optimal accuracy
- โก Advanced Tactical Search - 6-14+ ply search with PVS, iterative deepening, and sophisticated pruning techniques
- ๐ง NNUE Integration - Efficiently Updatable Neural Networks for fast position evaluation
- ๐ Pattern Confidence Assessment - Intelligently decides when to use patterns vs tactical calculation
- ๐ Configurable Blending - Adjustable weights between pattern, NNUE, and tactical evaluations
- ๐ฎ Full UCI Compliance - Complete chess engine with pondering, Multi-PV, and all standard UCI features
๐ฅ๏ธ GPU Acceleration
- ๐ Intelligent Device Detection - Auto-detects CUDA โ Metal โ CPU with seamless fallback
- โก 10-100x Speedup Potential - GPU-accelerated similarity search for large datasets
- ๐๏ธ Adaptive Performance - Uses optimal compute strategy based on dataset size
- ๐ Built-in Benchmarking - Performance testing and GFLOPS measurement
๐ฌ Advanced Analytics
- ๐ Vector Position Encoding - Convert chess positions to 1024-dimensional vectors capturing piece positions, game state, and strategic features
- ๐ Multi-tier Similarity Search - GPU/parallel/sequential search with automatic method selection
- ๐ง Memory-Optimized Neural Networks - Sequential batch processing eliminates memory explosion during training
- ๐ค Neural Compression - 8:1 to 32:1 compression ratios (1024d โ 128d/32d) with 95%+ accuracy retention and 75% less memory usage
- ๐ Opening Book - Comprehensive opening book with 50+ chess openings and 45+ ECO codes for fast lookup
๐ฏ Advanced Search & Pruning
- โ๏ธ Principal Variation Search (PVS) - Advanced search algorithm with 20-40% speedup over alpha-beta
- โ๏ธ Sophisticated Pruning - Futility pruning, razoring, extended futility pruning for 2-5x search speedup
- ๐ง Enhanced LMR - Improved Late Move Reductions with depth and move-based reduction formulas
- ๐ฏ Advanced Move Ordering - MVV-LVA captures, killer moves, history heuristic for optimal branch evaluation
- โก Multi-threading - Parallel root search with configurable thread count for 2-4x performance gain
- ๐งฉ Tactical Position Detection - Automatically identifies positions requiring deeper analysis
- โฑ๏ธ Time Management - Sophisticated time allocation and search controls for tournament play
- ๐ง Quiescence Search - Horizon effect avoidance with capture and check extensions
โก Performance & Scalability
- ๐ Production Optimizations - 7 major performance optimizations for 2-5x overall improvement
- โก Ultra-Fast Loading - O(nยฒ) โ O(n) duplicate detection with binary format priority (seconds instead of minutes/hours)
- ๐ฅ๏ธ Multi-GPU Acceleration - Automatic detection and utilization of multiple GPUs with CPU fallback
- ๐ป SIMD Vector Operations - AVX2/SSE4.1/NEON optimized similarity calculations for 2-4x speedup
- ๐ง Pre-computed Vector Norms - 3x faster similarity search with cached norm calculations
- ๐ Dynamic Hash Table Sizing - 30% LSH performance improvement with adaptive memory allocation
- โก Reference-based Search - 50% memory reduction with zero-copy search results
๐ฆ Installation
Cargo (Recommended)
# Or add to your Cargo.toml
From Source
๐ฏ Quick Start
Basic Engine Usage
use ChessVectorEngine;
use Board;
use FromStr;
// Create the engine
let mut engine = new;
// Enable features
engine.enable_opening_book;
// Analyze positions
let board = from_str.unwrap;
let evaluation = engine.evaluate_position;
let similar_positions = engine.find_similar_positions;
println!;
Advanced Usage with Neural Networks
use ;
// Create engine with advanced features
let mut engine = new;
// Configure strong tactical search
let tactical_config = TacticalConfig ;
engine.enable_tactical_search;
engine.configure_hybrid_evaluation;
// Load training data for pattern recognition
engine.auto_load_training_data?;
// Advanced evaluation with all features
let evaluation = engine.evaluate_position;
UCI Engine
# Run as UCI engine
# Or use installed binary
# In your chess GUI, configure engine path to the binary
Training Data Loading
// Auto-load training data (detects format automatically)
engine.auto_load_training_data?;
// Load specific format
engine.load_training_data?;
// Load chess puzzles for tactical training
if new.exists
๐ง Command Line Tools
The engine includes several demonstration and utility programs:
# Basic engine demonstration
# UCI engine for chess GUIs
# Position analysis tool
# Performance benchmarking
# Feature system demonstration
๐งช Architecture
Core Components
- PositionEncoder - Converts chess positions to 1024-dimensional vectors
- SimilaritySearch - K-NN search through position vectors using cosine similarity
- TacticalSearch - Advanced minimax search with PVS and sophisticated pruning
- NNUE - Neural network evaluation with incremental updates
- OpeningBook - Fast hash-map lookup for 50+ openings with ECO codes
- UCIEngine - Full UCI protocol implementation with pondering and Multi-PV
- HybridEvaluator - Intelligent blending of pattern, neural, and tactical evaluation
Hybrid Evaluation Pipeline
Chess Position โ PositionEncoder โ Vector (1024d)
โ
โโ Opening Book (instant lookup) โโ
โ โ
โโ Pattern Recognition โโโ Confidence Assessment
โ (similarity search) โ
โ โโ High Confidence โ Pattern Evaluation
โ โโ Low Confidence โ Tactical Search (PVS)
โ โ
โโโโโโโโโโโโโโโ Hybrid Blending โโโ Final Evaluation
โ
NNUE Evaluation โ Neural Position Assessment
โ
GPU Acceleration โ 10-100x speedup
๐ Performance Characteristics
Loading Performance (Large Datasets)
- Memory-mapped files: Instant startup with zero-copy loading
- MessagePack format: 10-20% faster than binary formats
- Zstd compression: Best compression ratios with fast decompression
- Binary formats: 5-15x faster than JSON
- Streaming JSON: Parallel processing for large JSON files
Search Performance
- Tactical search: 1000-2800+ nodes/ms depending on configuration
- GPU acceleration: 10-100x speedup for large similarity searches
- Multi-threading: 2-4x speedup with parallel root search
- SIMD operations: 2-4x speedup for vector calculations
๐ ๏ธ Development
Building from Source
# Clone repository
# Build library
# Run tests
# Run benchmarks
Key Dependencies
chess(3.2) - Chess game logic and position representationndarray(0.16) - Numerical arrays for vector operationscandle-core/candle-nn(0.9) - Neural network frameworkrayon(1.10) - Data parallelism for multi-threadingserde(1.0) - Serialization for training data
Architecture Components
- PositionEncoder - Converts chess positions to 1024-dimensional vectors
- SimilaritySearch - k-NN search with multiple algorithms (linear, LSH, GPU)
- TacticalSearch - Advanced chess search with PVS, pruning, and move ordering
- NNUE - Neural network evaluation with incremental updates and hybrid blending
- OpeningBook - Fast hash-map lookup for chess openings
- AutoDiscovery - Intelligent training data detection and format optimization
- UltraFastLoader - Memory-mapped and streaming loaders for massive datasets
๐งช Testing
The engine includes comprehensive test coverage:
# Run all tests
# Run specific module tests
# Run with full output
Current test coverage: 105 tests passing across all modules.
๐ Roadmap
Version 0.2.0 (Q1 2026)
- Enhanced neural network architectures
- Improved multi-GPU scaling
- Advanced endgame evaluation
- Tournament time management
Version 0.3.0 (Q2 2026)
- Distributed training infrastructure
- Cloud deployment automation
- Advanced analytics dashboard
- Custom algorithm framework
Version 1.0.0 (Q3 2026)
- Production stability guarantees
- Full enterprise feature set
- Comprehensive documentation
- Professional support tier
๐ค Contributing
We welcome contributions to the open source core! Please see CONTRIBUTING.md for guidelines.
Open Source Contributions
- Bug fixes and improvements to core features
- Performance optimizations
- Documentation improvements
- Test coverage expansion
- New open source features
๐ License
This project is licensed under MIT OR Apache-2.0 at your option.
See LICENSE for full details.
๐ Support
- GitHub Issues - Bug reports and feature requests
- Documentation - Comprehensive API documentation at docs.rs
- Examples - Extensive code examples and demonstrations
๐ Acknowledgments
Built with excellent open source libraries:
- chess - Chess game logic and position representation
- ndarray - Numerical computing and linear algebra
- candle - Neural network framework from HuggingFace
- rayon - Data parallelism and multi-threading
- tokio - Async runtime for concurrent operations
Special thanks to the chess programming community and contributors to:
- Stockfish - Reference for advanced search algorithms and evaluation techniques
- Leela Chess Zero - Inspiration for neural network integration in chess engines
- Chess Programming Wiki - Comprehensive resource for chess engine development
Ready to revolutionize chess AI? Start with cargo install chess-vector-engine and explore the power of vector-based position analysis!