poker-distilbert

DistilBERT fine-tuned to predict the action a poker solver chooses in 6-player No Limit Hold'em. Given a hand written in PokerBench prompt format, it predicts one of five actions: fold, call, check, raise, or bet.

Code, evaluation scripts, and the full write-up: github.com/jinha1491/poker-multi-agent

Results

PokerBench test split, 11,000 hands:

Version Test accuracy Macro F1
Majority class baseline 25.0%
v1 67.28% 0.652
v2 (current) 74.39% 0.712

Accuracy by street (v2): preflop 84.8%, flop 73.2%, turn 76.1%, river 71.2%.

On a stratified 300-hand sample of the test set, v2 scored 76.0% against 46.7% for a GPT-4o-mini multi-agent pipeline, with a median latency of 53 ms on CPU against 5.5 s.

Usage

The model only gives reliable predictions on hands in PokerBench's prompt format.

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

repo = "jinha1491/poker-distilbert"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)
labels = ["fold", "call", "check", "raise", "bet"]  # class index order

prompt = "..."  # one hand in PokerBench's prompt format
inputs = tokenizer(prompt, truncation=True, max_length=256, return_tensors="pt")
with torch.no_grad():
    probs = model(**inputs).logits.softmax(dim=-1)[0]

print(labels[probs.argmax()], round(probs.max().item(), 3))

To load the earlier version, pass revision="v1" to both from_pretrained calls.

Training

  • Base model: distilbert-base-uncased
  • Data: 50,000 hands from a seeded shuffle (seed 42) of the PokerBench training split, 80/20 train/validation split
  • Labels: the solver's action with bet sizes removed, giving 5 classes
  • 5 epochs, AdamW at 2e-5 with linear warmup, batch size 16, class-weighted cross entropy, 256-token inputs
  • Trained on an Apple M-series laptop (MPS)

Versions

  • v1: trained on the first 50,000 rows of the training split. PokerBench is stored in blocks, so those rows contained no preflop hands, and v1 scored 8.5% on preflop test hands.
  • v2: trained on a shuffled sample with the dataset's real preflop share (11.2%). Same base model and settings. Preflop accuracy went to 84.8%, and overall test accuracy from 67.28% to 74.39%.

Limitations

  • Trained on 50,000 of the 563,200 available training hands.
  • Bet is the weakest class (F1 0.55). Every missed bet in the test set was predicted as check, so the errors come from the bet or check decision itself.
  • PokerBench assigns one label per hand, while solvers often mix between actions in close spots. Some predictions counted as wrong are reasonable plays.
  • Inputs that don't follow PokerBench's prompt format are outside what the model was trained on, and its predictions on them shouldn't be trusted.
Downloads last month
30
Safetensors
Model size
67M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for jinha1491/poker-distilbert

Finetuned
(12775)
this model

Dataset used to train jinha1491/poker-distilbert