Commit Graph
100 Commits
Author SHA1 Message Date
coolguyandClaude Opus 4.7 a1215959a7 Warn when max_iterations is too small for any eval to run
If eval_every is positive but max_iterations falls before the next scheduled
eval iteration (including resume cases where current_iteration is already
past the last eval boundary), log a one-time warning at run start so the
user notices the misconfiguration. We deliberately do not force an
end-of-run eval, which would distort time budgets and reproducibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:03:28 +09:00
coolguyandClaude Opus 4.7 b561fa8457 Document run comparison protocol: sequential, single seed, shared tag
Default is one baseline + one treatment, sequential, same seed, with a
shared --wandb-tag hypothesis label for W&B Compare Runs filtering.
Multi-seed only on explicit request; never run two trainings on the same
GPU.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:56:17 +09:00
coolguyandClaude Opus 4.7 59b8f24b91 Document W&B notes length convention (3-5 lines, link long analyses)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:53:59 +09:00
coolguyandClaude Opus 4.7 611e4119a1 Document W&B notes/tag conventions in AGENTS.md
Brief guidance on roles (notes = purpose, tags = filter categories)
plus three anti-patterns to avoid. Otherwise free-form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:52:56 +09:00
coolguyandClaude Opus 4.7 54a5fdab2e Add --wandb-notes flag for run purpose description
Exposes wandb.init's notes field through the CLI so each run can carry a
short description of its purpose, visible on the W&B run page alongside
tags and config.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:50:33 +09:00
coolguyandClaude Opus 4.7 04ef99e7ef Document wandb integration in AGENTS.md; require AGENTS.md read upfront
- AGENTS.md: add Weights & Biases section covering install (extra),
  online/offline modes, per-run wandb/ layout, sync command, and the
  source-of-truth note (metrics.jsonl, not W&B).
- CLAUDE.md: replace soft "before making changes" wording with a
  mandatory session-start instruction to read AGENTS.md in full.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:48:33 +09:00
coolguyandClaude Opus 4.7 abfd7298d9 Surface eval cost in iteration summary
Append eval_seconds and its share of iteration_seconds to the per-iteration
console summary when evaluation actually ran, so users watching the log can
see how much wall time eval is consuming without parsing JSON metrics.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:44:19 +09:00
coolguyandClaude Opus 4.7 bac630b50b Bump avg-strategy 1000iter config: traversals 4x, LR 3e-5→1e-4, LCFR, lighter eval
Apply consultant + review recommendations to address training-budget
shortfall and underutilized weighting:

- traversal.traversals_per_player: 70 → 280 (4× sample touches/iter to
  reduce regret estimate variance early)
- optimization.learning_rate: 3e-5 → 1e-4 (was too low for the 512×1024
  updates schedule)
- training_weighting.mode: none → lcfr (faster convergence; alpha/beta/
  gamma fields are inert with mode=none)
- evaluation.eval_every: 5 → 25 (eval was costing more wall-clock than
  training; 6 opponents × 100 games × 200 evals adds up)
- Drop accidental duplicate keys in traversal/optimization sections
  (YAML last-wins, harmless but confusing)

Wall-clock estimate ~13h on the existing setup. If results clearly
improve, consider 8× traversals (560) as a follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:40:32 +09:00
coolguyandClaude Opus 4.7 acb664c873 Auto-derive run dir from experiment_name + timestamp
Drop checkpoint.directory from config — config defines what an experiment
is, not where its outputs go. The CLI now computes the run directory from
run.experiment_name plus a timestamp, defaulting to runs/tmp/ for
throwaway runs and runs/ when --keep is passed.

- Remove CheckpointConfig.directory and DeepCFRConfig.checkpoint_path
- DeepCFRTrainer takes run_dir: Path explicitly
- CLI: add --keep boolean; --resume requires an explicit path (no shortcut)
- Auto path: runs/[tmp/]<YYYY-MM-DD_HHMMSS>_<experiment_name-kebab>/
- Rename 13 configs to kebab-case; strip directory: lines; kebab their
  experiment_name values
- Rewrite AGENTS.md training/run sections; document
  archive/tmp/<flat> layout, --keep, kebab-case scope
- Update tests for new run_dir flow and dropped --resume shortcut

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:32:44 +09:00
coolguyandClaude Opus 4.7 a177031963 Clean up Deep CFR config schema
Remove legacy aliases, rename max_hours to max_minutes, collapse the
four checkpoint save flags into save_every + save_latest, and change
defaults to safer values (opponent_policy=self_play_league,
device=auto, eval_every=50, max_depth=null). Migrate all archived
yaml configs and tests to the new schema.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:09:19 +09:00
coolguy c2b88d7c9c Use configured train device 2026-05-07 15:58:10 +09:00
coolguy 0fea13786f Use generic train config overrides 2026-05-07 15:53:43 +09:00
coolguyandClaude Opus 4.7 44dd97876e Add optional wandb metrics tracking
Mirror Deep CFR training metrics to W&B via a new WandbRunTracker
wired through CompositeRunTracker; wandb is an optional extra so
default installs and runs stay unchanged. Train CLI gains
--wandb/--wandb-project/--wandb-mode/--wandb-name/--wandb-tag, and
train() now closes the tracker in a finally block so runs finalize
even on early exit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 15:42:30 +09:00
coolguy 2c96c5ee82 Archive docs markdown files 2026-05-07 15:39:24 +09:00
coolguy 2414b651d5 Update agent docs 2026-05-07 15:38:32 +09:00
coolguy b1e77b6db0 Disable default analysis smoothing 2026-05-07 15:28:12 +09:00
coolguy 4c223f76ff Add generic Deep CFR config overrides 2026-05-07 15:26:39 +09:00
coolguy 43507375fc Add external sampling traversal mode 2026-05-07 15:23:40 +09:00
coolguy 712a1eedaf Add eval game record export 2026-05-07 14:13:15 +09:00
coolguyandClaude Haiku 4.5 f398c9fc4c Add opponent_policy=average_strategy support
Strategy network (학습 중인 average policy)를 traversal opponent로 사용하는
새 옵션 추가. Deep CFR 이론적 수렴이 average strategy에 대한 보장이라는
점에 착안 — opponent_policy=network의 발산 문제를 완화할 수 있는지 실증.

구현:
- config: opponent_policy validator에 average_strategy 추가
- traversal.pyx: opponent_policy_id=3, strategy_network 인자, softmax 기반
  policy 도출 (_policy_from_strategy_network)
- workers.py: TraversalWorkerBatch에 strategy_network state_dict 추가
- trainer.py: 직렬/병렬 traversal call에 strategy_network 전달
- 1000-iter 실험 config 추가 (opponent_policy=network와 동일 hyperparam)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-07 14:07:28 +09:00
coolguyandClaude Haiku 4.5 6b8c36ebb2 docs: opponent_policy 비교에 동일 조건 self_play_league run 추가
같은 hyperparameter (512x3, 2x updates, argmax_tiebreak)에 opponent_policy
만 self_play_league로 다른 run과의 iteration별 비교 표 추가. iter 350
시점에서 Random WR 38%p 격차 (network 34% vs league 72%) 확인 — 발산
가설을 실증.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-07 13:56:43 +09:00
coolguyandClaude Haiku 4.5 d0316293e4 Document opponent_policy=network divergence finding
opponent_policy=network 설정으로 1000-iter 실험 두 개 (512x3, 1024x4)를
돌린 결과 두 실험 모두 policy collapse가 발생함을 확인. 큰 capacity는
plateau를 늘리지만 발산 자체를 막지 못함. 향후 학습은 self_play_league
기본값을 유지할 것을 권고.

- 실험에 사용한 config 두 개 추가
- 발견 분석 문서 추가 (원인, 비교, 권고)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-07 13:47:36 +09:00
coolguyandClaude Haiku 4.5 cf67bc2198 Add color_shared + attention 1000-iteration experimental config
- hidden_size: 256 (smaller for faster iteration)
- num_layers: 2
- color_attention_layers: 2, color_attention_heads: 8
- max_iterations: 1000
- advantage/strategy_updates: 256 (reduced from 512)
- Ready for experimental training run

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-07 09:21:50 +09:00
coolguyandClaude Haiku 4.5 b7fce79f5b Add example configs for color_shared network architectures
- Add deep_cfr_color_shared_512x3.yaml: color_shared without attention
- Add deep_cfr_color_shared_attention_512x3.yaml: color_shared with 2-layer attention
- Both use 512 hidden size and 3 MLP layers
- Configs are ready for experimental training runs

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-07 09:19:02 +09:00
coolguyandClaude Haiku 4.5 cee8849e04 Add backward-compatible color_shared network architecture
- Add network.kind field to config (mlp/color_shared)
- Implement ColorSharedNetwork that:
  - Splits input into 5 equal color blocks
  - Encodes each block with shared weights
  - Pools with mean/max aggregation
  - Concatenates pooled embeddings with remainder
  - Outputs same action logits as MLP
- Add ColorAttention for optional self-attention over color embeddings
- Add network.color_attention_layers and color_attention_heads config
- Maintain full backward compatibility (default kind=mlp)
- Add 28 comprehensive tests covering all architectures

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-07 09:18:13 +09:00
coolguyandClaude Haiku 4.5 fd99d3bb4a Deep CFR self-play anchor safe 512x3 2x updates 10000 iter config 및 관련 변경
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-07 09:14:23 +09:00
coolguy c779621823 Deep CFR pure self-play 512x3 2x updates config 추가 2026-05-07 07:55:05 +09:00
coolguy 55f4ae89a4 Deep CFR 512x3 LCFR config 추가 2026-05-07 07:12:39 +09:00
coolguy 6d84745daa Limit Deep CFR traversal futures in flight 2026-05-07 07:11:45 +09:00
coolguy ccf7f825f7 Deep CFR 512x3 2x updates config 추가 2026-05-07 07:11:02 +09:00
coolguy 768c071e90 Deep CFR 512x3 unbounded config 추가 2026-05-07 07:05:11 +09:00
coolguy 4712a9af89 Deep CFR LCFR DCFR loss weighting 추가 2026-05-07 06:30:48 +09:00
coolguy e1a5185d4d Deep CFR 아이디어와 분석 플롯 정리 2026-05-07 06:21:19 +09:00
coolguy 080bff517e Deep CFR regret fallback audit metrics 추가 2026-05-07 05:23:23 +09:00
coolguy 690e086738 Improve Deep CFR analysis dashboards 2026-05-07 04:58:27 +09:00
coolguy 4ec784217b Deep CFR legacy 학습 dynamics 정렬 2026-05-07 04:20:11 +09:00
coolguy 6433081ed2 Deep CFR 분석 대시보드 정리 2026-05-07 04:05:31 +09:00
coolguy f5a72aeaec 프로젝트 운영 가이드 추가 2026-05-07 04:04:10 +09:00
coolguy 5fa4bd65ef Deep CFR 무제한 학습 config 추가 2026-05-07 03:52:59 +09:00
coolguy 148be6e9a0 Deep CFR evaluation 배칭 및 병렬화 추가 2026-05-07 03:42:00 +09:00
coolguy 54347e1e7f Deep CFR evaluation 프로파일링 메트릭 추가 2026-05-07 03:10:19 +09:00
coolguy 9acf9ed261 Deep CFR advantage memory를 player별로 분리 2026-05-07 02:59:03 +09:00
coolguy e411ea4a15 Deep CFR 프로파일링 메트릭 추가 2026-05-07 02:50:35 +09:00
coolguy b5b4f97d41 Deep CFR slot-aware encoding NaN 수정 2026-05-07 02:32:24 +09:00
coolguy ece82fc310 Deep CFR traversal을 Cython 엔진으로 교체 2026-05-07 02:25:33 +09:00
coolguy a76e8fd716 Deep CFR 성능 traversal gap 문서화 2026-05-07 02:12:14 +09:00
coolguy cd3f7cea3b Add test coverage notes 2026-05-07 02:11:16 +09:00
coolguy facd6eb36a Deep CFR traversal 재귀 한도 보강 2026-05-07 02:02:56 +09:00
coolguy 44a96f5b4c Deep CFR checkpoint CLI override 추가 2026-05-07 01:59:16 +09:00
coolguy fc4f0ddfd8 Deep CFR resume 동작 보강 2026-05-07 01:55:10 +09:00
coolguy 1645d22e87 Deep CFR 콘솔 트래킹 출력 정리 2026-05-07 01:47:54 +09:00
coolguy 1420ab76bd Deep CFR run tracking 추상화 2026-05-07 01:44:15 +09:00
coolguy 1b6d98ceeb Deep CFR traversal 운영 로그 보강 2026-05-07 01:23:26 +09:00
coolguy d29b3d60bb Deep CFR 재현 config 이름 정리 2026-05-07 01:15:34 +09:00
coolguy df8f979ce4 Deep CFR 재현 config 실행 보강 2026-05-07 01:12:09 +09:00
coolguy bbf8950c3a Deep CFR 재현 config run dir 정리 2026-05-07 01:05:23 +09:00
coolguy 312cbd3949 Deep CFR evaluation 진단 metric 추가 2026-05-07 01:03:09 +09:00
coolguy 7ef7e5b927 Deep CFR endpoint depth metrics 보강 2026-05-07 00:54:16 +09:00
coolguy 95d0660b0b Deep CFR playability encoding 추가 2026-05-07 00:52:28 +09:00
coolguy 9bcc88c1be Deep CFR legacy 재현 config 기반 추가 2026-05-07 00:46:09 +09:00
coolguy 898f927cb2 Deep CFR legacy 실험 재현 계획 문서화 2026-05-07 00:41:19 +09:00
coolguy f593a6d910 Deep CFR YAML config 추가 2026-05-07 00:30:42 +09:00
coolguy d86e534ba9 Deep CFR status 문서 갱신 2026-05-07 00:14:51 +09:00
coolguy b71f4b95be Deep CFR policy gradient fine-tuning 추가 2026-05-07 00:13:53 +09:00
coolguy 647baa7d6d Deep CFR imitation pretraining 추가 2026-05-07 00:12:41 +09:00
coolguy 8f54415832 Deep CFR multiprocessing benchmark 보강 2026-05-07 00:11:01 +09:00
coolguy 5555e781af Deep CFR weighted self-play league 추가 2026-05-07 00:09:36 +09:00
coolguy 573b59545f Deep CFR legacy gap 문서 정리 2026-05-07 00:02:25 +09:00
coolguy 46d841cf11 Deep CFR self-play league 추가 2026-05-07 00:01:19 +09:00
coolguy a5bd5eeb7e Deep CFR traversal multiprocessing과 benchmark 추가 2026-05-06 23:59:01 +09:00
coolguy 76833109dc Deep CFR 로컬 metrics logging 추가 2026-05-06 23:54:52 +09:00
coolguy fc5b3d9bc8 Deep CFR checkpoint eval CLI 추가 2026-05-06 23:52:50 +09:00
coolguy 65e7abefad Deep CFR 정보 상태 encoding 확장 2026-05-06 23:48:12 +09:00
coolguy 66d02f773e Deep CFR reservoir memory 추가 2026-05-06 23:45:50 +09:00
coolguy 6f4ef89ea2 Deep CFR outcome sampling과 rollout cutoff 추가 2026-05-06 23:42:29 +09:00
coolguy 5a9166bf5a Deep CFR gap 문서 최신화 2026-05-06 23:37:43 +09:00
coolguy e802efabc3 Deep CFR 재귀 traversal 구현 2026-05-06 23:35:46 +09:00
coolguy 966cfa3a13 Deep CFR v0 legacy gap 문서 추가 2026-05-06 23:18:24 +09:00
coolguy b5d82f99a1 Deep CFR v0 스모크 파이프라인 추가 2026-05-06 23:15:06 +09:00
coolguy ce6c9685da Deep CFR v0 계획 문서 추가 2026-05-06 23:10:46 +09:00
coolguy 6c35b878a5 Deep CFR 기초 모듈 추가 2026-05-06 23:06:23 +09:00
coolguy 4224ef7a88 PassiveDiscardBot 정책 인터페이스 상속 추가 2026-05-06 22:53:20 +09:00
coolguy 91b8846894 정책 인터페이스로 네이밍 정리 2026-05-06 22:52:04 +09:00
coolguy 8763430475 게임 엔진을 game 모듈로 통합 2026-05-06 22:42:09 +09:00
coolguy c1c50267b5 FastGameState를 기본 게임 상태로 전환 2026-05-06 22:35:51 +09:00
coolguy 7e8c29478f 고속 엔진 패리티 테스트 강화 2026-05-06 22:13:23 +09:00
coolguy 2629fbdd99 고속 엔진 undo stack 추가 2026-05-06 22:02:04 +09:00
coolguy a349cf34ed 고속 엔진 안전성 보강 2026-05-06 21:56:59 +09:00
coolguy 2e38fc6454 고속 엔진 Cython API 선언 추가 2026-05-06 21:51:08 +09:00
coolguy 2450fd3737 고속 엔진 hot path 최적화 2026-05-06 21:45:17 +09:00
coolguy ec0e468fa1 고속 게임 엔진 골격 추가 2026-05-06 21:40:33 +09:00
coolguy 771c0ec821 평가 스키마와 게임 undo 기반 정리 2026-05-06 21:28:15 +09:00
coolguy 1843d93df2 봇 실행 헬퍼를 평가 모듈로 통합 2026-05-06 20:45:14 +09:00
coolguy 407d592f5e 미구현 레퍼런스 자리 제거 2026-05-06 20:42:26 +09:00
coolguy 1e5c5509e1 백엔드 제거하고 평가 기반 정리 2026-05-06 20:39:21 +09:00
coolguy b578b38628 Rust 지원 제거
맥락: 클래식 포트를 Python/Cython 구현과 pygame GUI 중심으로 정리한다.

변경: Rust 크레이트, proto 계약, Rust backend shim, 패리티 테스트를 삭제하고 문서와 backend factory를 Python 전용으로 갱신했다.

확인: uv run pre-commit run --all-files; uv run pytest tests/games/classic; uv run lost-cities-classic-gui --help
2026-05-06 20:11:43 +09:00
coolguy a6de79d444 클래식 pygame GUI 이식
맥락:
- classic 게임을 사람이 플레이할 수 있도록 레거시 pygame GUI를 가져온다.
- 현재 GUI는 Python backend와 registry bot만 지원하고 Rust backend와 학습 checkpoint 로딩은 제외한다.

변경:
- pygame_pvp.py를 classic 패키지에 이식하고 tier, backend 선택, Deep CFR checkpoint 옵션을 제거했다.
- lost-cities-classic-gui 엔트리포인트와 README 실행 안내를 추가했다.
- GUI argparse smoke 테스트를 추가했다.

확인:
- uv run pre-commit run --all-files
- uv run pytest tests/games/classic
- uv run lost-cities-classic-gui --help
- SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy uv run python - <<'PY'
from coolrl_lost_cities.games.classic.pygame_pvp import LostCitiesGuiApp
app = LostCitiesGuiApp(mode='pvc', bot_name='random', seed=1, width=1024, height=768)
app.draw()
app.pygame.quit()
print('gui init ok')
PY
2026-05-06 20:08:05 +09:00
coolguy 12b59211b2 Python 포맷팅과 pre-commit 설정
맥락:
- Python 코드만 대상으로 Ruff 기반 format/lint와 pre-commit hook을 도입한다.
- Cython game.pyx는 Ruff 대상에서 제외해 포맷터 충돌을 피한다.

변경:
- ruff와 pre-commit dev dependency 및 Ruff 설정을 추가했다.
- pre-commit config와 Python format/check 스크립트를 추가했다.
- Ruff format/check --fix 결과로 Python import 정렬과 포맷을 적용했다.

확인:
- uv sync --extra gui
- uv run pre-commit run --all-files
- scripts/check-python.sh
- uv run lost-cities-classic
2026-05-06 19:59:07 +09:00
coolguy b43bb5917f Rust 크레이트를 루트로 이동
맥락:
- GUI 이식 전에 Rust crate와 proto schema 위치를 Python package 내부에서 분리한다.
- Cargo 작업, IDE 인식, 빌드 산출물 관리를 루트 구조에 맞춘다.

변경:
- rust_core를 rust/lost-cities-core로 이동하고 proto/lost_cities.proto를 루트 proto 디렉터리로 옮겼다.
- Rust build.rs, Python Rust backend, Rust parity 테스트의 경로를 새 위치로 수정했다.
- Python package-data에서 Rust crate와 proto 항목을 제거하고 README/port notes를 갱신했다.

확인:
- uv sync --extra gui --reinstall-package coolrl-lost-cities
- uv run pytest tests/games/classic
- uv run lost-cities-classic
2026-05-06 19:50:32 +09:00
coolguy 73fe7e2c94 GUI 선택 의존성 준비
맥락:
- pygame GUI 이식 전에 core 설치와 GUI 의존성을 분리하고 asset 로딩 경로를 고정한다.

변경:
- pyproject에 gui extra로 pygame과 pygame-gui를 추가했다.
- classic resource helper를 추가해 packaged asset 경로를 importlib.resources 기반으로 읽게 했다.
- theme asset resource 테스트와 README 설치 안내를 추가했다.

확인:
- uv sync --extra gui
- uv run pytest tests/games/classic
- uv run lost-cities-classic
2026-05-06 19:32:07 +09:00