JackHopkinsGSL commited on
Commit
97b8ea4
·
verified ·
1 Parent(s): 8708f55

Add model card

Browse files
Files changed (1) hide show
  1. README.md +206 -171
README.md CHANGED
@@ -1,199 +1,234 @@
1
  ---
2
- library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
 
11
 
12
  ## Model Details
13
 
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
 
 
100
 
101
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
 
 
106
 
107
- ### Testing Data, Factors & Metrics
 
 
 
108
 
109
- #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
 
 
 
112
 
113
- [More Information Needed]
 
 
 
114
 
115
- #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
 
119
- [More Information Needed]
 
 
 
 
 
 
 
 
120
 
121
- #### Metrics
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
 
124
 
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
 
 
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
1
  ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ tags:
6
+ - gin-rummy
7
+ - card-games
8
+ - behavioral-cloning
9
+ - reinforcement-learning
10
+ - game-ai
11
+ base_model: Qwen/Qwen3.5-0.8B
12
+ datasets:
13
+ - GoodStartLabs/gin-rummy-trajectories-32k
14
+ metrics:
15
+ - accuracy
16
+ pipeline_tag: text-generation
17
  ---
18
 
19
+ # Gin Rummy HBC - Qwen3.5 0.8B
 
 
20
 
21
+ **Behavioral cloning model for Gin Rummy trained via supervised fine-tuning on expert trajectories.**
22
 
23
+ This model was trained on 32,000 stratified expert game states to learn optimal Gin Rummy decision-making. It serves as the initialization for subsequent GRPO (Group Relative Policy Optimization) self-play training.
24
 
25
  ## Model Details
26
 
27
+ - **Model type:** Causal language model (decoder-only transformer)
28
+ - **Base model:** [Qwen/Qwen3.5-0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B)
29
+ - **Parameters:** 0.8B parameters
30
+ - **Training method:** LoRA (Low-Rank Adaptation) fine-tuning
31
+ - **Task:** Gin Rummy move prediction
32
+ - **License:** Apache 2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ ## Training Data
35
 
36
+ **Dataset:** [GoodStartLabs/gin-rummy-trajectories-32k](https://huggingface.co/datasets/GoodStartLabs/gin-rummy-trajectories-32k)
37
 
38
+ - **Training samples:** 32,000 (stratified sampling, minimum 1,000 per action type)
39
+ - **Validation samples:** 1,000 (perfectly balanced, 200 per action type)
40
+ - **Source:** Expert agent gameplay using Monte Carlo Tree Search (MCTS)
41
 
42
+ **Action distribution (training set):**
43
+ - `discard` (discard a card): 44.6%
44
+ - `draw` (draw from stock): 33.1%
45
+ - `+discard` (pick from discard pile): 14.9%
46
+ - `KNOCK-[card]` (knock and discard): 4.0%
47
+ - `pass` (pass on upcard): 3.5%
48
+
49
+ **Validation set:** Perfectly balanced with exactly 200 samples per action type for unbiased evaluation.
50
+
51
+ ## Training Procedure
52
+
53
+ **Fine-tuning platform:** Together AI (serverless LoRA training)
54
+
55
+ **Hyperparameters:**
56
+ - LoRA rank: 16 (0.8B, 2B) / 32 (4B)
57
+ - LoRA alpha: 16 (0.8B, 2B) / 32 (4B)
58
+ - LoRA dropout: 0.05
59
+ - LoRA modules: all-linear
60
+ - Learning rate: 1e-4 (0.8B) / 5e-5 (2B, 4B)
61
+ - Batch size: 8
62
+ - Epochs: 3
63
+ - Warmup ratio: 0.1
64
+ - Weight decay: 0.01
65
+ - Max gradient norm: 1.0
66
+ - **Train on inputs:** False (loss calculated only on assistant response tokens)
67
+
68
+ **Training duration:** ~2-4 hours per model
69
+
70
+ **Infrastructure:**
71
+ - Platform: Together AI
72
+ - GPUs: NVIDIA H100 (serverless)
73
+ - Precision: bfloat16
74
+
75
+ ## Intended Use
76
+
77
+ ### Primary Use Case
78
+
79
+ This model serves as the **warm-start initialization** for GRPO self-play training:
80
+
81
+ 1. **HBC (Behavioral Cloning)** ← *This model*
82
+ - Learn from expert trajectories
83
+ - Acquire strong baseline policy
84
+ - Fast convergence to competent play
85
+
86
+ 2. **GRPO (Group Relative Policy Optimization)** ← *Next stage*
87
+ - Self-play reinforcement learning
88
+ - Discover novel strategies
89
+ - Optimize for win rate
90
+
91
+ ### Inference
92
+
93
+ The model predicts the next action given the current game state formatted as a chat conversation:
94
+
95
+ **Input format:**
96
+ ```
97
+ [SYSTEM]
98
+ You are an expert Gin Rummy player. Your goal is to minimize deadwood and form melds.
99
+
100
+ [USER]
101
+ History:
102
+ 1. You: +D6x -C3
103
+ 2. Opp: draw -CK
104
+
105
+ Now:
106
+ Hand: CK D2 D3 D4 D5 D6 D9 H7 HK HQ S9
107
+ Stock: 28 | Deadwood: 45 | Phase: discard_or_knock
108
+ YOUR TURN | Can: no
109
+
110
+ [ASSISTANT]
111
+ ```
112
+
113
+ **Output (predicted action):**
114
+ ```
115
+ -H7
116
+ ```
117
+
118
+ **Action format:**
119
+ - `draw` - Draw from stock pile
120
+ - `+discard` - Pick from discard pile
121
+ - `-[CARD]` - Discard a card (e.g., `-H7` = discard 7 of Hearts)
122
+ - `KNOCK-[CARD]` - Knock and discard (e.g., `KNOCK-C3`)
123
+ - `pass` - Pass on the initial upcard
124
+
125
+ **Card notation:** Rank (A/2-9/T/J/Q/K) + Suit (C/D/H/S)
126
+ - Example: `H7` = 7 of Hearts, `CK` = King of Clubs, `SA` = Ace of Spades
127
+
128
+ ## Usage
129
+
130
+ ```python
131
+ from transformers import AutoModelForCausalLM, AutoTokenizer
132
+
133
+ # Load model and tokenizer
134
+ model_name = "GoodStartLabs/gin-rummy-hbc-qwen3.5-0.8b"
135
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
136
+ model = AutoModelForCausalLM.from_pretrained(
137
+ model_name,
138
+ device_map="auto",
139
+ torch_dtype="auto",
140
+ )
141
+
142
+ # Format game state as chat
143
+ messages = [
144
+ {
145
+ "role": "system",
146
+ "content": "You are an expert Gin Rummy player. Your goal is to minimize deadwood and form melds."
147
+ },
148
+ {
149
+ "role": "user",
150
+ "content": '''History:
151
+ 1. Opp: draw -SQ
152
+ 2. You: draw(DT) -DT
153
+
154
+ Now:
155
+ Hand: C9 D3 D9 H3 H6 HJ HQ HT S6 S9
156
+ Stock: 22 | Deadwood: 18 | Phase: draw
157
+ YOUR TURN | Can: no'''
158
+ }
159
+ ]
160
+
161
+ # Generate prediction
162
+ text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
163
+ inputs = tokenizer(text, return_tensors="pt").to(model.device)
164
+
165
+ outputs = model.generate(
166
+ **inputs,
167
+ max_new_tokens=20,
168
+ temperature=0.0, # Greedy decoding for deterministic play
169
+ do_sample=False,
170
+ )
171
+
172
+ action = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True).strip()
173
+ print(f"Predicted action: {action}")
174
+ ```
175
+
176
+ ## Limitations
177
+
178
+ - **Behavioral cloning ceiling:** Model is limited by the quality of expert demonstrations. Cannot exceed expert performance without RL.
179
+ - **Distribution shift:** May struggle on game states not represented in training data.
180
+ - **Stochastic policy:** Model predicts a distribution over actions; greedy decoding gives deterministic play but may not explore optimally.
181
+ - **No opponent modeling:** Does not explicitly model opponent strategy (though may learn implicit patterns from game history).
182
+ - **Fixed strategy:** Cannot adapt during a game; uses the same policy throughout.
183
 
184
  ## Evaluation
185
 
186
+ **Validation accuracy (on balanced 1K validation set):**
187
+ - Overall: *TBD* (check W&B: [good-start-labs/gin-rummy-hbc](https://wandb.ai/good-start-labs/gin-rummy-hbc))
188
+ - Per action type: *TBD*
189
 
190
+ **Win rate vs. baselines:**
191
+ - Random policy: *TBD*
192
+ - Greedy heuristic: *TBD*
193
+ - Expert policy: *TBD*
194
 
195
+ ## Ethical Considerations
196
 
197
+ This model is trained for the game of Gin Rummy and should only be used for:
198
+ - Game AI research
199
+ - Educational purposes
200
+ - Entertainment (single-player practice, AI opponents)
201
 
202
+ **Not intended for:**
203
+ - Real-money gambling
204
+ - Cheating in online games
205
+ - Deceptive or manipulative applications
206
 
207
+ ## Citation
208
 
209
+ If you use this model in your research, please cite:
210
 
211
+ ```bibtex
212
+ @misc{gin-rummy-hbc-0.8b,
213
+ author = {Good Start Labs},
214
+ title = {Gin Rummy HBC - Qwen3.5 0.8B},
215
+ year = {2026},
216
+ publisher = {HuggingFace},
217
+ howpublished = {\url{GoodStartLabs/gin-rummy-hbc-qwen3.5-0.8b}},
218
+ }
219
+ ```
220
 
221
+ ## Model Card Authors
222
 
223
+ - Good Start Labs
224
+ - Contact: [GitHub](https://github.com/GoodStartLabs)
225
 
226
+ ## Model Card Contact
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
+ For questions or issues with this model:
229
+ - Open an issue on the [model repository](https://huggingface.co/GoodStartLabs/gin-rummy-hbc-qwen3.5-0.8b)
230
+ - Check [W&B training logs](https://wandb.ai/good-start-labs/gin-rummy-hbc)
231
 
232
+ ---
233
 
234
+ *Model trained on Together AI • Base model: Qwen3.5 • Training date: March 2026*