Text Generation
PEFT
Safetensors
gin-rummy
grpo
reinforcement-learning
lora
game-playing
qwen3
conversational
Eval Results (legacy)
Instructions to use GoodStartLabs/ginrummy-qwen3-8b-grpo-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use GoodStartLabs/ginrummy-qwen3-8b-grpo-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/workspace/models/Qwen3-8B") model = PeftModel.from_pretrained(base_model, "GoodStartLabs/ginrummy-qwen3-8b-grpo-lora") - Notebooks
- Google Colab
- Kaggle
Update model card with eval results, usage instructions, and Wilson CIs
Browse files
README.md
CHANGED
|
@@ -1,39 +1,190 @@
|
|
| 1 |
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
base_model: Qwen/Qwen3-8B
|
| 4 |
-
|
| 5 |
-
|
| 6 |
library_name: peft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
| **Method** | GRPO (TRL GRPOTrainer) |
|
| 17 |
-
| **
|
| 18 |
-
| **
|
| 19 |
-
| **
|
| 20 |
-
| **
|
| 21 |
-
| **
|
| 22 |
-
| **
|
| 23 |
-
| **
|
| 24 |
-
| **Dataset** | Self-play rollouts vs algorithmic bot |
|
| 25 |
-
|
| 26 |
-
## Config
|
| 27 |
-
- `enable_thinking=False`, minimal prompt (no tools), `num_generations=4`, `lr=1e-6`
|
| 28 |
-
- Sparse terminal reward only (+1/-1/0)
|
| 29 |
|
| 30 |
-
##
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
## Usage
|
|
|
|
|
|
|
|
|
|
| 34 |
```python
|
| 35 |
from peft import PeftModel
|
| 36 |
-
from transformers import AutoModelForCausalLM
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
model = PeftModel.from_pretrained(base, "GoodStartLabs/ginrummy-qwen3-8b-grpo-lora")
|
|
|
|
|
|
|
|
|
|
| 39 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
base_model: Qwen/Qwen3-8B
|
| 3 |
+
datasets:
|
| 4 |
+
- self-play
|
| 5 |
library_name: peft
|
| 6 |
+
license: apache-2.0
|
| 7 |
+
tags:
|
| 8 |
+
- gin-rummy
|
| 9 |
+
- grpo
|
| 10 |
+
- reinforcement-learning
|
| 11 |
+
- lora
|
| 12 |
+
- game-playing
|
| 13 |
+
- qwen3
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
+
model-index:
|
| 16 |
+
- name: ginrummy-qwen3-8b-grpo-lora
|
| 17 |
+
results:
|
| 18 |
+
- task:
|
| 19 |
+
type: text-generation
|
| 20 |
+
name: Math Reasoning (GSM8K)
|
| 21 |
+
dataset:
|
| 22 |
+
name: GSM8K
|
| 23 |
+
type: gsm8k
|
| 24 |
+
metrics:
|
| 25 |
+
- type: accuracy
|
| 26 |
+
value: 91.1
|
| 27 |
+
name: Accuracy
|
| 28 |
+
verified: false
|
| 29 |
+
- task:
|
| 30 |
+
type: text-generation
|
| 31 |
+
name: Science Reasoning (ARC Challenge)
|
| 32 |
+
dataset:
|
| 33 |
+
name: ARC Challenge
|
| 34 |
+
type: ai2_arc
|
| 35 |
+
metrics:
|
| 36 |
+
- type: accuracy
|
| 37 |
+
value: 96.3
|
| 38 |
+
name: Accuracy
|
| 39 |
+
verified: false
|
| 40 |
+
- task:
|
| 41 |
+
type: text-generation
|
| 42 |
+
name: Factual Accuracy (TruthfulQA)
|
| 43 |
+
dataset:
|
| 44 |
+
name: TruthfulQA
|
| 45 |
+
type: truthful_qa
|
| 46 |
+
metrics:
|
| 47 |
+
- type: accuracy
|
| 48 |
+
value: 69.0
|
| 49 |
+
name: Accuracy
|
| 50 |
+
verified: false
|
| 51 |
+
- task:
|
| 52 |
+
type: text-generation
|
| 53 |
+
name: Broad Knowledge (MMLU-Pro)
|
| 54 |
+
dataset:
|
| 55 |
+
name: MMLU-Pro
|
| 56 |
+
type: TIGER-Lab/MMLU-Pro
|
| 57 |
+
metrics:
|
| 58 |
+
- type: accuracy
|
| 59 |
+
value: 59.7
|
| 60 |
+
name: Accuracy
|
| 61 |
+
verified: false
|
| 62 |
+
- task:
|
| 63 |
+
type: text-generation
|
| 64 |
+
name: Commonsense Reasoning (HellaSwag)
|
| 65 |
+
dataset:
|
| 66 |
+
name: HellaSwag
|
| 67 |
+
type: hellaswag
|
| 68 |
+
metrics:
|
| 69 |
+
- type: accuracy
|
| 70 |
+
value: 73.3
|
| 71 |
+
name: Accuracy
|
| 72 |
+
verified: false
|
| 73 |
---
|
| 74 |
|
| 75 |
+
# ginrummy-qwen3-8b-grpo-lora
|
| 76 |
+
|
| 77 |
+
A LoRA adapter trained via **GRPO** (Group Relative Policy Optimization) on Gin Rummy self-play, built on [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B).
|
| 78 |
+
|
| 79 |
+
## Evaluation Results vs Base Model
|
| 80 |
+
|
| 81 |
+
Benchmarked against the base Qwen3-8B (via OpenRouter) with n=300 samples per benchmark and Wilson 95% confidence intervals.
|
| 82 |
|
| 83 |
+
| Benchmark | Base Qwen3-8B | This Model | Delta | 95% CI (this model) | Significant? |
|
| 84 |
+
|-----------|:---:|:---:|:---:|:---:|:---:|
|
| 85 |
+
| **GSM8K** (math) | **96.3%** | 91.1% | -5.2% | [87.9%, 93.5%] | Borderline |
|
| 86 |
+
| **ARC Challenge** (science) | 70.7% | **96.3%** | **+25.6%** | [93.5%, 97.9%] | Yes |
|
| 87 |
+
| **TruthfulQA** (factual) | 65.7% | **69.0%** | +3.3% | [63.6%, 74.0%] | No |
|
| 88 |
+
| **MMLU-Pro** (knowledge) | **70.3%** | 59.7% | -10.6% | [54.1%, 65.1%] | Yes |
|
| 89 |
+
| **HellaSwag** (commonsense) | 69.0% | **73.3%** | +4.3% | [68.0%, 78.0%] | No |
|
| 90 |
|
| 91 |
+
**Key findings:**
|
| 92 |
+
- Massive improvement on ARC Challenge (+25.6%), likely due to improved strategic reasoning from RL training
|
| 93 |
+
- Regression on MMLU-Pro (-10.6%) and GSM8K (-5.2%), consistent with RL fine-tuning trading broad knowledge for task-specific reasoning
|
| 94 |
+
- TruthfulQA and HellaSwag differences are within noise
|
| 95 |
+
|
| 96 |
+
## Training Details
|
| 97 |
+
|
| 98 |
+
| Parameter | Value |
|
| 99 |
+
|-----------|-------|
|
| 100 |
| **Method** | GRPO (TRL GRPOTrainer) |
|
| 101 |
+
| **Base model** | Qwen/Qwen3-8B |
|
| 102 |
+
| **Training steps** | 200 (800 games) |
|
| 103 |
+
| **Learning rate** | 1e-6 |
|
| 104 |
+
| **Training setup** | Self-play vs algorithmic bot (GinRummyBot) |
|
| 105 |
+
| **Win rate achieved** | 16.8% |
|
| 106 |
+
| **Hardware** | Together AI 8x H100 80GB |
|
| 107 |
+
| **Training time** | 11.9 minutes |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
+
### LoRA Configuration
|
| 110 |
+
|
| 111 |
+
```
|
| 112 |
+
r = 16
|
| 113 |
+
lora_alpha = 32
|
| 114 |
+
target_modules = [q_proj, k_proj, v_proj, o_proj]
|
| 115 |
+
task_type = CAUSAL_LM
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
### Training Hyperparameters
|
| 119 |
+
|
| 120 |
+
- `enable_thinking=False` (no reasoning tokens)
|
| 121 |
+
- `num_generations=4`
|
| 122 |
+
- Sparse terminal reward only (+1/-1/0)
|
| 123 |
+
- Minimal prompt (no tool use)
|
| 124 |
|
| 125 |
## Usage
|
| 126 |
+
|
| 127 |
+
### With PEFT (direct loading)
|
| 128 |
+
|
| 129 |
```python
|
| 130 |
from peft import PeftModel
|
| 131 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 132 |
+
import torch
|
| 133 |
+
|
| 134 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 135 |
+
"Qwen/Qwen3-8B",
|
| 136 |
+
torch_dtype=torch.bfloat16,
|
| 137 |
+
device_map="auto",
|
| 138 |
+
)
|
| 139 |
+
model = PeftModel.from_pretrained(base_model, "GoodStartLabs/ginrummy-qwen3-8b-grpo-lora")
|
| 140 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
### With vLLM (serving)
|
| 144 |
+
|
| 145 |
+
```bash
|
| 146 |
+
vllm serve Qwen/Qwen3-8B \
|
| 147 |
+
--enable-lora \
|
| 148 |
+
--max-lora-rank 16 \
|
| 149 |
+
--lora-modules ginrummy=GoodStartLabs/ginrummy-qwen3-8b-grpo-lora \
|
| 150 |
+
--max-model-len 4096 \
|
| 151 |
+
--enforce-eager \
|
| 152 |
+
--port 8000
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
Then query via OpenAI-compatible API:
|
| 156 |
+
|
| 157 |
+
```python
|
| 158 |
+
from openai import OpenAI
|
| 159 |
+
|
| 160 |
+
client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
|
| 161 |
+
response = client.chat.completions.create(
|
| 162 |
+
model="ginrummy",
|
| 163 |
+
messages=[{"role": "user", "content": "Your prompt here"}],
|
| 164 |
+
max_tokens=512,
|
| 165 |
+
)
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
### Merge into base model (standalone)
|
| 169 |
+
|
| 170 |
+
```python
|
| 171 |
+
from peft import PeftModel
|
| 172 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 173 |
+
import torch
|
| 174 |
+
|
| 175 |
+
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B", torch_dtype=torch.bfloat16, device_map="auto")
|
| 176 |
model = PeftModel.from_pretrained(base, "GoodStartLabs/ginrummy-qwen3-8b-grpo-lora")
|
| 177 |
+
model = model.merge_and_unload()
|
| 178 |
+
model.save_pretrained("./qwen3-8b-ginrummy-merged")
|
| 179 |
+
AutoTokenizer.from_pretrained("Qwen/Qwen3-8B").save_pretrained("./qwen3-8b-ginrummy-merged")
|
| 180 |
```
|
| 181 |
+
|
| 182 |
+
## Limitations
|
| 183 |
+
|
| 184 |
+
- This is a **baseline run** (run 9 of iteration series) with no reasoning tokens or tool use
|
| 185 |
+
- Win rate of 16.8% indicates early-stage training; further iterations expected
|
| 186 |
+
- See the [experiment log](https://github.com/GoodStartLabs/GinRummy_RLenv/blob/main/grpo_training/experiment_log.md) for the full iteration history
|
| 187 |
+
|
| 188 |
+
## Eval Methodology
|
| 189 |
+
|
| 190 |
+
Evaluations run using [Inspect AI](https://inspect.ai-safety-institute.org.uk/) (v0.3.x). Fine-tuned model served via vLLM 0.18.0 on A100-80GB. Base model accessed via OpenRouter. Full results with Wilson CIs available at [GoodStartLabs/huggingface-evals](https://github.com/GoodStartLabs/huggingface-evals).
|