{"id":44765416,"url":"https://github.com/tachyon-beep/keisei","last_synced_at":"2026-02-16T03:39:49.571Z","repository":{"id":293984860,"uuid":"985665874","full_name":"tachyon-beep/keisei","owner":"tachyon-beep","description":"A Deep Reinforcement Learning project demonstrating AI's power to create AI, aimed at mastering the complex game of Shogi. Built 100% by GitHub Copilot (Agent Mode) with human project management, it features a custom Shogi engine, PPO in PyTorch, rich experiment tracking via Weights \u0026 Biases, and a live TUI using Rich for dynamic monitoring.","archived":false,"fork":false,"pushed_at":"2026-02-07T16:19:00.000Z","size":29043,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-07T16:50:35.548Z","etag":null,"topics":["actor-critic","ai-coded","artificial-intelligence","board-games","custom-game-engine","deep-reinforcement-learning","experiment-tracking","game-ai","generative-ai-development","github-copilot","neural-networks","ppo","python","pytorch","rich-library","self-play","shogi","strategy-games","terminal-ui","weights-and-biases"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tachyon-beep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-18T09:10:07.000Z","updated_at":"2025-09-21T10:53:27.000Z","dependencies_parsed_at":"2025-06-01T12:28:39.514Z","dependency_job_id":"b34bf1bf-561c-45dd-93cf-a52239b4ec4f","html_url":"https://github.com/tachyon-beep/keisei","commit_stats":null,"previous_names":["tachyon-beep/shogidrl","tachyon-beep/keisei"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tachyon-beep/keisei","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon-beep%2Fkeisei","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon-beep%2Fkeisei/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon-beep%2Fkeisei/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon-beep%2Fkeisei/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tachyon-beep","download_url":"https://codeload.github.com/tachyon-beep/keisei/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon-beep%2Fkeisei/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29499615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T02:07:14.481Z","status":"online","status_checked_at":"2026-02-16T02:03:22.852Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actor-critic","ai-coded","artificial-intelligence","board-games","custom-game-engine","deep-reinforcement-learning","experiment-tracking","game-ai","generative-ai-development","github-copilot","neural-networks","ppo","python","pytorch","rich-library","self-play","shogi","strategy-games","terminal-ui","weights-and-biases"],"created_at":"2026-02-16T03:39:48.985Z","updated_at":"2026-02-16T03:39:49.567Z","avatar_url":"https://github.com/tachyon-beep.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keisei: Deep Reinforcement Learning for Shogi\n\n**Keisei** (形勢, \"position\" in Shogi) is a deep reinforcement learning system that learns to play Shogi from scratch through self-play, using Proximal Policy Optimization (PPO).\n\nNo opening books, no hardcoded heuristics — strategies emerge purely from reinforcement learning.\n\n## Project Intent\n\nKeisei has three legs with clear priority:\n\n1. **Primary:** Showcase Shogi as a rich, competitive game worthy of continuous public exhibition.\n2. **Primary:** Showcase deep reinforcement learning as a first-class AI paradigm, not as an accessory to LLM workflows.\n3. **Subordinate:** Evaluate how effective LLMs are at building and evolving this system.\n\nThe first two define what we are building. The third measures how we build it.\n\n## Features\n\n- **Complete Shogi engine** with full rule support (drops, promotions, repetition)\n- **PPO with self-play** — clipped surrogate, GAE, entropy regularization\n- **ResNet + SE blocks** — configurable tower depth/width with Squeeze-and-Excitation attention\n- **46-channel observation** (9x9 board) with 13,527-action policy space\n- **Mixed precision** (AMP) and multi-GPU (DDP) support\n- **Pydantic configuration** with YAML files and CLI overrides\n- **Streamlit dashboard** for real-time training visualization\n- **Weights \u0026 Biases** integration for experiment tracking\n- **5 evaluation strategies** — single opponent, tournament, ladder, benchmark, custom\n\n## Quick Start\n\n### Prerequisites\n\n- Python 3.12+ (3.13 recommended)\n- CUDA-compatible GPU (optional but recommended)\n- [uv](https://docs.astral.sh/uv/) package manager\n\n### Installation\n\n```bash\ngit clone https://github.com/tachyon-beep/shogidrl.git\ncd keisei\n\n# Create environment and install\nuv venv .venv\nsource .venv/bin/activate\nuv pip install -e \".[dev]\"\n\n# Optional: configure Weights \u0026 Biases\necho \"WANDB_API_KEY=your_key\" \u003e .env\n```\n\n### Training\n\n```bash\n# Basic training\npython train.py train\n\n# With custom config\npython train.py train --config examples/enhanced_display_config.yaml\n\n# With CLI overrides\npython train.py train --override training.learning_rate=0.001\n\n# Resume from checkpoint\npython train.py train --resume models/my_model/checkpoint.pt\n\n# With Streamlit dashboard\npython train.py train --override webui.enabled=true\n```\n\n### Evaluation\n\n```bash\npython train.py evaluate \\\n  --agent_checkpoint path/to/model.pt \\\n  --opponent_type random \\\n  --num_games 100\n```\n\n## Architecture\n\nKeisei uses a manager-based architecture with 9 specialized components orchestrated by a central `Trainer`:\n\n| Manager | Responsibility |\n|---------|---------------|\n| **SessionManager** | Directories, W\u0026B setup, config persistence |\n| **ModelManager** | Model creation, checkpoints, mixed precision |\n| **EnvManager** | Game environment, policy mapper, lifecycle |\n| **StepManager** | Step execution, episode management, experience collection |\n| **TrainingLoopManager** | Main loop, PPO updates, callbacks |\n| **MetricsManager** | Statistics, progress tracking, formatting |\n| **DisplayManager** | Stderr logging (throttled one-line summaries) |\n| **CallbackManager** | Event system, evaluation scheduling, checkpoints |\n| **SetupManager** | Component initialization, validation, dependencies |\n\n**Optional:** StreamlitManager provides a real-time training dashboard via atomic JSON state file.\n\n## Project Structure\n\n```\nkeisei/\n├── config_schema.py           # Pydantic configuration models\n├── constants.py               # Shared constants\n├── core/                      # PPO agent, experience buffer, neural networks\n├── shogi/                     # Complete Shogi game engine\n├── training/                  # Manager-based training infrastructure\n│   ├── models/                # Neural network architectures (ResNet, CNN)\n│   └── parallel/              # Multi-process experience collection\n├── evaluation/                # Multi-strategy evaluation system\n├── webui/                     # Streamlit training dashboard\n└── utils/                     # Logging, checkpoints, profiling\n```\n\n## Configuration\n\nConfiguration uses `default_config.yaml` with Pydantic validation. Override any setting via CLI:\n\n```bash\npython train.py train \\\n  --override training.learning_rate=0.001 \\\n  --override training.mixed_precision=true \\\n  --override webui.enabled=true\n```\n\nSee `default_config.yaml` for all available options.\n\n## Development\n\n```bash\n# Run tests\npytest tests/unit/              # Fast unit tests\npytest tests/integration/       # Integration tests\npytest tests/e2e/               # End-to-end tests\n\n# Full local CI\n./scripts/run_local_ci.sh\n\n# Code quality\nblack keisei/                   # Formatting\nmypy keisei/                    # Type checking\nflake8 keisei/                  # Linting\n```\n\nSee [CLAUDE.md](CLAUDE.md) for detailed development workflow, architecture notes, and contribution guidelines.\n\n## Documentation\n\n- [CLAUDE.md](CLAUDE.md) — Development guide with commands, architecture details, and patterns\n- [docs/DESIGN.md](docs/DESIGN.md) — System design document\n- [docs/CODE_MAP.md](docs/CODE_MAP.md) — Detailed code organization\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftachyon-beep%2Fkeisei","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftachyon-beep%2Fkeisei","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftachyon-beep%2Fkeisei/lists"}