Downloads · 30 days
41
39% of all-time downloads
braitoli/d1-poker-ev-psych-v7
d1-poker-ev-psych-v7 is a reinforcement learning model from braitoli. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. It is set up for keras. The card lists the license as mit.
⚠️ D1 KHÔNG phải là LLM / language model. Nó là một mạng nơ-ron nhỏ (MLP, 281,577 params ≈ 1.1 MB) học ra quyết định chơi poker bằng EV kết hợp phân tích tâm lý đối thủ theo hướng AISTATS09 (Data Biased Robust Counter…
Downloads · 30 days
41
39% of all-time downloads
All-time downloads
106
Public
Repo size
6.3 MB
Likes
0
Public
Click a slice to open those files.
.keras4.2 MB · 66%
From the Hugging Face model README
⚠️ D1 KHÔNG phải là LLM / language model. Nó là một mạng nơ-ron nhỏ (MLP, 281,577 params ≈ 1.1 MB) học ra quyết định chơi poker bằng EV kết hợp phân tích tâm lý đối thủ theo hướng AISTATS09 (Data Biased Robust Counter Strategies). Không có tokenizer, không sinh text — input là vector feature 148 chiều mô tả một "spot" poker, output là EV dự đoán, xác suất fold của đối thủ (p_fold), và policy hành động.
Version: v3 (2026-08-03) — nâng từ v2 (17.6K params) lên 281K params + data g1 (13,838 spots) + pot-control serve-time (chống raise-war).
| Thuộc tính | Giá trị |
|---|---|
| Kiến trúc | MLP 3 heads (backbone shared), width=336, dropout=0.1 |
| Input | Vector 148 chiều (spot state + stats đối thủ + λ) |
| Heads | ev_head (EV bb/action ×4), psych_head (p_fold logit), policy_head (policy ×4) |
| Loss | CE(policy) + γ·CE(ev_best) + α·MSE(ev) + β·BCE(p_fold), nhãn p_fold dạng soft label f2c/100, sentinel -1 masked |
| Params | 281,577 (~1.1 MB) |
| Export | Keras .keras (3.4 MB) · TFLite f32 (1.1 MB) · TFLite int8 (307 KB) |
| Dữ liệu train | 13,838 spots poker 6-max (A9 dataset + g1), split 11,762 / 2,076 |
| Số tay benchmark | 15 seeds × 500 hands × 4 bots × 2 modes (120,000 hands heads-up) |
| Trận A9 thật | 4 trận × 100 hands vs A9 production trên API /decide |
Dựa trên AISTATS09 – Data Biased Robust Counter Strategies (Ganzfried & Sandholm): khi chưa rõ đối thủ thì chơi chiến thuật robust (EV thuần), càng quan sát được đối thủ thì càng nghiêng sang exploit.
f2c/100, đúng tinh thần AISTATS09 là dùng
tần suất hành động quan sát được thay vì lớp persona rời rạc.spots_g1_retry_early
(~3.4k spots mới), 40 epochs.CE(policy) + γ·CE(ev_best) + α·MSE(ev) + β·BCE(p_fold) với
EV-guided policy loss (γ=0.5) — policy head bị ép theo nhãn argmax EV proxy trên legal, không chỉ copy teacher (fix "quên value-bet" 2026-08-03).policy_acc 76.8% (chọn đúng hành động trong 4 legal)ev_best_acc 73.1% (độ khớp với hành động EV-tối ưu — model học
"ra quyết định bằng EV")psych_mae 0.019 (~sai số 2 điểm f2c % — psych head thực sự học được
tín hiệu; so với nhãn persona 2 lớp trước đây val ~49% = đoán mò)ev_mae_scaled 0.055Lưu ý params: tăng 17.6K → 281K KHÔNG tạo đột phá bb/100 (bottleneck là dữ liệu 13.8k spots) nhưng giảm variance rõ (station std 1.81→0.65) và tăng raise% (aggressive hơn) — xem bảng benchmark dưới.
Chi tiết: train_report.json
Giao thức: 15 seeds × 500 hands/matchup, đấu 4 bot baseline, so sánh chế độ adaptive (λ=f(n) thật, tăng theo số tay quan sát) vs λ=0 (robust thuần, không xem stats đối thủ). Kết quả bb/100 (mean±std):
| Đối thủ | λ adaptive | λ=0 (robust) | Nhận xét |
|---|---|---|---|
| random | +21.34±1.27 | +21.53±1.22 | Thắng đều cả 2 mode |
| potodds | −21.53±1.41 | −21.46±0.86 | Thua bot equity-aware (giới hạn EV proxy) |
| station | +20.93±0.65 | +20.91±1.56 | Ổn định nhất (std 0.65, so v2 1.81) |
| foldheavy | +14.66±10.2 | +18.61±3.68 | Thắng bot fold nhiều (adaptive std lớn, caveat) |
Model adaptive đổi chiến thuật theo HUD đối thủ đo thật (tracker đo f2c khi gặp bet postflop):
| vs random | vs potodds | vs station | vs foldheavy | |
|---|---|---|---|---|
| f2c đo được của bot | 36.0% | 24.8% | 0% | 25.0% |
| raise% λ adaptive | 36.7% | 16.5% | 14.5% | 67.3% |
| raise% λ=0 | 68.5% | 61.9% | 62.3% | 64.1% |
→ Model biết "đối thủ fold thì bluff nhiều" (raise 67.3% vs foldheavy nhưng chỉ 14.5% vs station không bao giờ fold); λ=0 chơi một kiểu với tất cả.
λ ramp thật theo số tay quan sát: first-50 λ≈0.12 → last-50 λ≈0.97–1.0. raise% theo block λ khớp hoàn hảo: vs random/potodds/station raise hạ dần khi λ tăng (63.6→27.2% / 52.4→11.3% / 58.7→13.2%), vs foldheavy giữ cao (64.2→69.7%) — model học "thăm dò lúc chưa rõ, khai thác khi đã rõ".
⚠️ Adaptation ≠ improvement: trước EV-guided fix, adaptive rất passive vs potodds/station (check nhiều) — vs station λ0 (+20.76) thắng đậm adaptive (+10.94). Sau fix (2026-08-03), adaptive vs station lên +20.58 (chênh λ0 chỉ 0.9) — model đã học value-bet song song với tránh bluff vào đối thủ không fold. Bằng chứng đáng tin cậy nhất là λ ramp + action distribution đổi theo đối thủ.
/decide)Đấu heads-up vs A9 production (LLM ~2B params finetune, latency ~3.4s vs D1 23ms):
| Trận | D1 | A9 | Ghi chú |
|---|---|---|---|
| seed 42 | −112 BB | +112 | 1 hand cooler −96BB (full house 6 vs full house J) |
| seed 7 | +101 BB | −101 | Thắng áp đảo |
| seed 99 | −7.5 BB | +7.5 | Giằng co |
| seed 123 | −14 BB | +14 | Giằng co |
| Trung bình | −8.1 BB/100 | +8.1 | ≈ ngang cơ A9 |
Pot-control serve-time (fix raise-war 2026-08-03, không cần retrain):
Chi tiết đầy đủ: benchmark_report.json
| File | Mô tả |
|---|---|
model.keras | Model Keras đầy đủ (3.4 MB) |
model.tflite | TFLite float32 (1.1 MB) |
model_int8.tflite | TFLite int8 quantized (307 KB) — khuyên dùng cho edge |
model_size.txt | Số params + kích thước từng export |
train_report.json | Metrics train/val + size |
benchmark_report.json | Kết quả 8 matchup × 15 seeds đầy đủ |
README.md | Model card này |
import tensorflow as tf
model = tf.keras.models.load_model("model.keras")
# Input: (batch, 148) float32 — vector từ features.encode_spot()
# Output: [policy(4), ev_bb(4), psych_logit(1)] (split output)
import numpy as np
import tensorflow as tf
interp = tf.lite.Interpreter(model_path="model_int8.tflite")
interp.allocate_tensors()
inp = interp.get_input_details()[0]
out = interp.get_output_details()
x = np.random.rand(1, 148).astype(np.float32)
interp.set_tensor(inp["index"], x)
interp.invoke()
policy, ev, psych_logit = [interp.get_tensor(o["index"])[0] for o in out]
Parity Keras ↔ TFLite int8 đã verify: action + λ-gating khớp nhau.
Vector được tạo từ một "spot" gồm: stack/pot/to_call/spr/pot_odds, street,
position, hole cards, board, legal actions, action history, stats đối thủ
(vpip/pfr/af/f2c…) — và λ (số tay quan sát). Công thức encode đầy đủ trong
features.py của repo nguồn (xem phần "Repo nguồn").
ev = eq·(pot+2X) − X (xấp xỉ bằng
equity Monte-Carlo + cấu trúc pot), không phải rollout đầy đủ.Code đầy đủ (train, benchmark, D1 decider, 43 unit tests, verify TFLite parity)
nằm tại thư mục tf_model/ trong repo
github.com/braitoli/finetune-poker-model (nhánh eval/sixway_selfplay_summary).
Design doc: docs/2026-08-02-tiny-tf-ev-psych-design.md.
Model D1 — prototype nghiên cứu. Được tạo 2026-08-02 bởi braitoli.