creole / README.md
hsperr's picture
Model card: Creole v2.0.0 card play (score-based PIMC)
af678e9 verified
|
Raw History Blame Contribute Delete
5.21 kB
---
license: apache-2.0
library_name: pytorch
tags:
- bridge
- contract-bridge
- game-ai
- reinforcement-learning
- self-play
- imperfect-information
---
# Creole
A contract-bridge bot: one neural network bids 33 bidding systems, told which system each side
plays; a belief network plus PIMC plays the cards. Creole is the big brother of
[Pidgin](https://huggingface.co/hsperr/pidgin), which invented one system of its own.
Code, server and Docker image: [github.com/hsperr/creole](https://github.com/hsperr/creole) ·
`docker run -p 8080:8080 ghcr.io/hsperr/creole`
## Files
| File | What | Params | Size | sha256 |
|---|---|---|---|---|
| `creole_bid_rl2_s4500.pt` | Joint net: bidding, and the card head that breaks PIMC ties | 28.1M | 112 MB | `b4fb42d7…b41c3e` |
| `creole_belief_m2_s61962.pt` | Belief net: who holds each unseen card | 52.4M | 209 MB | `00e49d20…5f0577` |
Plain PyTorch state dicts (`torch.load(..., weights_only=True)`), float32. The model classes are in
`creole/model.py` of the code repo.
## Use
```bash
docker run --rm -p 8080:8080 ghcr.io/hsperr/creole
curl 'localhost:8080/apis/brill/bid?seat=N&dealer=N&vul=None&hand=AKQ2.KJ4.T98.762&ctx=&ourSystem=2/1&theirSystem=SAYC'
# {"bid": "1C", "candidates": [...], "model": "Creole"}
```
The server speaks [Brill's Seat Robot API](https://brill.aalborgdata.dk/seat-api.html)
(BEN-compatible): `/apis/brill/bid`, `/lead`, `/play`. CPU only, about 0.8 GB of memory,
about 15 ms a call and 0.2 s a card on one thread.
## Systems
2/1 GF (GIB/BBO, BEN 2/1 and eight EPBot 2/1 cards), SAYC (eight variants), Acol, Polish Club
(WJ), Precision, UCBC, WBridge5, and VieNNa (Pidgin's own). `ep_*` systems are EPBot convention
cards. Pass the system per side as `ourSystem` / `theirSystem`; the full list is at `GET /apis/brill/`.
## Architecture
- **Joint net.** Causal transformer, 8 layers, width 512, 8 heads, over the board's events (calls,
then cards). Learned embeddings for our side's and the opponents' system are added at every step.
Call head: 38 calls. Card head: a 2-layer attention encoder over the 52 cards.
- **Belief net.** Gated MLP, 8 SwiGLU blocks, width 1024. Reads the seat's view (hand, dummy, cards
played, the auction), both systems and a card-play-style token; outputs each unseen card's owner.
- **Card play.** Layouts drawn from temperature-softened belief probabilities (`T = 1.3`,
importance-weighted, resampled to 64), all solved double dummy with no time limit; best expected
duplicate contract score wins (with a joint-net opening-lead prior), and the joint net's card head
breaks ties within 15 points by masked argmax. Bidding is greedy: no search during the auction.
## Training
1. **One system, self-play.** Supervised on 6.4M deals bid and played by Pidgin V3.1, then 82k steps
of league self-play RL on duplicate IMPs with a KL leash.
2. **33 systems, supervised (37k steps).** Pidgin self-play (VieNNa calls distilled from step 1;
SAYC and 2/1 calls from BEN's nets), data from BEN, 18M auctions from earlier bidders (EPBot cards, BRL, Pidgin research
nets) and 7.4M auctions EPBot bid with ten more convention cards.
3. **33 systems, league RL (4,500 steps).** Self-play and PFSP league over all systems, KL leash to
stage 2: tight on early calls, loose deeper in the auction.
4. **Belief net.** Pidgin V4's belief net (incl. 1.15M WBridge5 deals), fine-tuned on the data
from BEN, widened to 33 systems and retrained on about 30M deals (61,962 steps).
All deals come from the public [Pgx DDS dataset](https://huggingface.co/datasets/sotetsuk/dds_dataset).
Details and negative results: [TRAINING.md](https://github.com/hsperr/creole/blob/main/TRAINING.md).
## Evaluation
Duplicate IMPs per board, ±95% CI. Creole bids the named system; the opponent bids its own.
Pidgin V4 on the same boards for comparison.
| Opponent | Creole's system | Boards | Creole | Pidgin V4 |
|---|---|---|---|---|
| Lia | 2/1 | 200 | −0.01 ± 0.88 | +1.12 ± 0.89 |
| Lia | VieNNa | 194 | +0.85 ± 0.99 | |
| Brill | GIB / BBO | 100 | +0.78 ± 1.26 | +1.23 |
| BEN | GIB / BBO | 100 | +0.32 ± 1.07 | +1.24 |
| Pidgin V4 | VieNNa | 400 | +0.34 ± 0.59 | |
## Limitations
- Every Creole interval above includes zero, and the samples are small (100–400 boards).
- Against these bots Pidgin V4 scored higher; Creole trades peak strength in one system for breadth.
- Weaker than Lia, Brill and BEN on declarer-play puzzles.
- No search during the auction; calls carry no explanations (`explanation` is empty).
- Nine research systems in the registry (`brl_fsp`, `D75`, `E46`, ...) work but are not tuned.
- How well an EPBot-card system matches the real card depends on how faithfully EPBot bids it.
## Data and reproducibility
No training data is released. The deals, BEN's nets and data, EPBot, WBridge5 and the BRL bidders
are public; the generated training sets (tens of millions of auctions from running those bots) and
the trainers are not. Rebuilding Creole means regenerating that data and rerunning the stages above.
The weights are trained on other programs' outputs; none of their code or data is included.
## Licence
Apache-2.0. © Henning Sperr.