File size: 5,515 Bytes
315c891
 
fd36fb6
 
840efda
fd36fb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315c891
 
fd36fb6
 
 
 
 
 
 
315c891
fd36fb6
 
 
 
 
 
 
315c891
fd36fb6
 
 
 
 
 
 
 
 
fa7100a
fd36fb6
 
 
 
 
 
 
fa7100a
fd36fb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
840efda
 
fd36fb6
 
 
840efda
 
fd36fb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
840efda
fd36fb6
 
 
840efda
fd36fb6
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
---
base_model: Qwen/Qwen3-8B
datasets:
- self-play
library_name: peft
license: apache-2.0
tags:
- gin-rummy
- grpo
- reinforcement-learning
- lora
- game-playing
- qwen3
pipeline_tag: text-generation
model-index:
- name: ginrummy-qwen3-8b-grpo-lora
  results:
  - task:
      type: text-generation
      name: Math Reasoning (GSM8K)
    dataset:
      name: GSM8K
      type: gsm8k
    metrics:
    - type: accuracy
      value: 91.1
      name: Accuracy
      verified: false
  - task:
      type: text-generation
      name: Science Reasoning (ARC Challenge)
    dataset:
      name: ARC Challenge
      type: ai2_arc
    metrics:
    - type: accuracy
      value: 96.3
      name: Accuracy
      verified: false
  - task:
      type: text-generation
      name: Factual Accuracy (TruthfulQA)
    dataset:
      name: TruthfulQA
      type: truthful_qa
    metrics:
    - type: accuracy
      value: 69.0
      name: Accuracy
      verified: false
  - task:
      type: text-generation
      name: Broad Knowledge (MMLU-Pro)
    dataset:
      name: MMLU-Pro
      type: TIGER-Lab/MMLU-Pro
    metrics:
    - type: accuracy
      value: 59.7
      name: Accuracy
      verified: false
  - task:
      type: text-generation
      name: Commonsense Reasoning (HellaSwag)
    dataset:
      name: HellaSwag
      type: hellaswag
    metrics:
    - type: accuracy
      value: 73.3
      name: Accuracy
      verified: false
---

# ginrummy-qwen3-8b-grpo-lora

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).

## Evaluation Results vs Base Model

Benchmarked against the base Qwen3-8B (via OpenRouter) with n=300 samples per benchmark and Wilson 95% confidence intervals.

| Benchmark | Base Qwen3-8B | This Model | Delta | 95% CI (this model) | Significant? |
|-----------|:---:|:---:|:---:|:---:|:---:|
| **GSM8K** (math) | **96.3%** | 91.1% | -5.2% | [87.9%, 93.5%] | Borderline |
| **ARC Challenge** (science) | 70.7% | **96.3%** | **+25.6%** | [93.5%, 97.9%] | Yes |
| **TruthfulQA** (factual) | 65.7% | **69.0%** | +3.3% | [63.6%, 74.0%] | No |
| **MMLU-Pro** (knowledge) | **70.3%** | 59.7% | -10.6% | [54.1%, 65.1%] | Yes |
| **HellaSwag** (commonsense) | 69.0% | **73.3%** | +4.3% | [68.0%, 78.0%] | No |

**Key findings:**
- Massive improvement on ARC Challenge (+25.6%), likely due to improved strategic reasoning from RL training
- Regression on MMLU-Pro (-10.6%) and GSM8K (-5.2%), consistent with RL fine-tuning trading broad knowledge for task-specific reasoning
- TruthfulQA and HellaSwag differences are within noise

## Training Details

| Parameter | Value |
|-----------|-------|
| **Method** | GRPO (TRL GRPOTrainer) |
| **Base model** | Qwen/Qwen3-8B |
| **Training steps** | 200 (800 games) |
| **Learning rate** | 1e-6 |
| **Training setup** | Self-play vs algorithmic bot (GinRummyBot) |
| **Win rate achieved** | 16.8% |
| **Hardware** | Together AI 8x H100 80GB |
| **Training time** | 11.9 minutes |

### LoRA Configuration

```
r = 16
lora_alpha = 32
target_modules = [q_proj, k_proj, v_proj, o_proj]
task_type = CAUSAL_LM
```

### Training Hyperparameters

- `enable_thinking=False` (no reasoning tokens)
- `num_generations=4`
- Sparse terminal reward only (+1/-1/0)
- Minimal prompt (no tool use)

## Usage

### With PEFT (direct loading)

```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

base_model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen3-8B",
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
model = PeftModel.from_pretrained(base_model, "GoodStartLabs/ginrummy-qwen3-8b-grpo-lora")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")
```

### With vLLM (serving)

```bash
vllm serve Qwen/Qwen3-8B \
  --enable-lora \
  --max-lora-rank 16 \
  --lora-modules ginrummy=GoodStartLabs/ginrummy-qwen3-8b-grpo-lora \
  --max-model-len 4096 \
  --enforce-eager \
  --port 8000
```

Then query via OpenAI-compatible API:

```python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
response = client.chat.completions.create(
    model="ginrummy",
    messages=[{"role": "user", "content": "Your prompt here"}],
    max_tokens=512,
)
```

### Merge into base model (standalone)

```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B", torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, "GoodStartLabs/ginrummy-qwen3-8b-grpo-lora")
model = model.merge_and_unload()
model.save_pretrained("./qwen3-8b-ginrummy-merged")
AutoTokenizer.from_pretrained("Qwen/Qwen3-8B").save_pretrained("./qwen3-8b-ginrummy-merged")
```

## Limitations

- This is a **baseline run** (run 9 of iteration series) with no reasoning tokens or tool use
- Win rate of 16.8% indicates early-stage training; further iterations expected
- See the [experiment log](https://github.com/GoodStartLabs/GinRummy_RLenv/blob/main/grpo_training/experiment_log.md) for the full iteration history

## Eval Methodology

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).