Spaces:
Sleeping
Sleeping
2reb commited on
Commit ยท
aa49c38
1
Parent(s): 2bb8829
Add Phase 2 Reasoner results: benchmark table, GRPO methodology, updated system prompt
Browse files
README.md
CHANGED
|
@@ -16,19 +16,23 @@ tags:
|
|
| 16 |
- economics
|
| 17 |
- qwen2.5
|
| 18 |
- qlora
|
|
|
|
|
|
|
| 19 |
- reasoning
|
| 20 |
- demo
|
| 21 |
models:
|
|
|
|
| 22 |
- 2reb/GameTheory-Solver
|
| 23 |
datasets:
|
| 24 |
- 2reb/GameTheory-Bench
|
| 25 |
---
|
| 26 |
|
| 27 |
-
# ๐ฏ GameTheory-
|
| 28 |
|
| 29 |
-
**An interactive demo for the [GameTheory-
|
| 30 |
|
| 31 |
-
[](https://huggingface.co/datasets/2reb/GameTheory-Bench)
|
| 33 |
[](https://opensource.org/licenses/Apache-2.0)
|
| 34 |
|
|
@@ -52,17 +56,21 @@ datasets:
|
|
| 52 |
| **Cooperative Games** | Shapley value, core, nucleolus |
|
| 53 |
| **Mechanism Design** | VCG, incentive compatibility, revelation principle |
|
| 54 |
|
| 55 |
-
## ๐ Model Performance
|
| 56 |
|
| 57 |
-
| Metric |
|
| 58 |
-
|---|:---:|
|
| 59 |
-
| **Overall Accuracy** | **94%** |
|
| 60 |
-
| **Hard Problems** | **94.4%** |
|
| 61 |
-
|
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
## ๐ Links
|
| 65 |
|
| 66 |
-
-
|
|
|
|
| 67 |
- ๐ **Dataset**: [2reb/GameTheory-Bench](https://huggingface.co/datasets/2reb/GameTheory-Bench) (2,913 verified problems)
|
| 68 |
- ๐ **Base Model**: [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct)
|
|
|
|
| 16 |
- economics
|
| 17 |
- qwen2.5
|
| 18 |
- qlora
|
| 19 |
+
- grpo
|
| 20 |
+
- reinforcement-learning
|
| 21 |
- reasoning
|
| 22 |
- demo
|
| 23 |
models:
|
| 24 |
+
- Alogotron/GameTheory-Reasoner
|
| 25 |
- 2reb/GameTheory-Solver
|
| 26 |
datasets:
|
| 27 |
- 2reb/GameTheory-Bench
|
| 28 |
---
|
| 29 |
|
| 30 |
+
# ๐ฏ GameTheory-Reasoner Demo
|
| 31 |
|
| 32 |
+
**An interactive demo for the [GameTheory-Reasoner](https://huggingface.co/Alogotron/GameTheory-Reasoner) model โ a Qwen2.5-7B trained through SFT + GRPO reinforcement learning with verifiable rewards to solve game theory problems with enhanced step-by-step reasoning.**
|
| 33 |
|
| 34 |
+
[](https://huggingface.co/Alogotron/GameTheory-Reasoner)
|
| 35 |
+
[](https://huggingface.co/2reb/GameTheory-Solver)
|
| 36 |
[](https://huggingface.co/datasets/2reb/GameTheory-Bench)
|
| 37 |
[](https://opensource.org/licenses/Apache-2.0)
|
| 38 |
|
|
|
|
| 56 |
| **Cooperative Games** | Shapley value, core, nucleolus |
|
| 57 |
| **Mechanism Design** | VCG, incentive compatibility, revelation principle |
|
| 58 |
|
| 59 |
+
## ๐ Model Performance: Base โ Solver โ Reasoner
|
| 60 |
|
| 61 |
+
| Metric | Base (82%) | Solver (Phase 1 SFT) | Reasoner (Phase 2 GRPO) |
|
| 62 |
+
|---|:---:|:---:|:---:|
|
| 63 |
+
| **Overall Accuracy** | 82% | **94%** | **94%** |
|
| 64 |
+
| **Hard Problems** | 66.7% | 94.4% | **94.4%** |
|
| 65 |
+
| **Reasoning Quality** | 0.48 | 0.51 | **0.54 (+6%)** |
|
| 66 |
+
| Bayesian Games | 0% | 100% | **100%** |
|
| 67 |
+
| Mechanism Design | 60% | 100% | **100%** |
|
| 68 |
+
|
| 69 |
+
> Phase 2 uses **GRPO (Group Relative Policy Optimization)** with verifiable rewards, achieving the same 94% accuracy while producing +6% better reasoning quality.
|
| 70 |
|
| 71 |
## ๐ Links
|
| 72 |
|
| 73 |
+
- ๐ง **Reasoner (Phase 2)**: [Alogotron/GameTheory-Reasoner](https://huggingface.co/Alogotron/GameTheory-Reasoner)
|
| 74 |
+
- ๐ค **Solver (Phase 1)**: [2reb/GameTheory-Solver](https://huggingface.co/2reb/GameTheory-Solver)
|
| 75 |
- ๐ **Dataset**: [2reb/GameTheory-Bench](https://huggingface.co/datasets/2reb/GameTheory-Bench) (2,913 verified problems)
|
| 76 |
- ๐ **Base Model**: [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct)
|
app.py
CHANGED
|
@@ -39,14 +39,15 @@ DIFFICULTY_COLORS = {
|
|
| 39 |
"hard": "๐ด",
|
| 40 |
}
|
| 41 |
|
| 42 |
-
SYSTEM_PROMPT = """You are GameTheory-
|
| 43 |
|
| 44 |
For every problem:
|
| 45 |
-
1.
|
| 46 |
-
2.
|
| 47 |
-
3.
|
| 48 |
-
4.
|
| 49 |
-
5.
|
|
|
|
| 50 |
|
| 51 |
Be precise with mathematical notation. Show all work. Format payoff matrices clearly using markdown tables when relevant."""
|
| 52 |
|
|
@@ -229,7 +230,8 @@ def build_app():
|
|
| 229 |
|
| 230 |
*An AI system trained to solve game theory problems with rigorous step-by-step reasoning*
|
| 231 |
|
| 232 |
-
[](https://huggingface.co/datasets/2reb/GameTheory-Bench)
|
| 234 |
[](https://huggingface.co/datasets/2reb/GameTheory-Bench)
|
| 235 |
"""
|
|
@@ -302,7 +304,7 @@ def build_app():
|
|
| 302 |
gr.Markdown(
|
| 303 |
"""Enter any game theory problem and get an AI-generated solution.
|
| 304 |
|
| 305 |
-
*Powered by Qwen2.5-7B-Instruct via the HuggingFace Inference API with
|
| 306 |
)
|
| 307 |
|
| 308 |
with gr.Row():
|
|
@@ -361,12 +363,50 @@ def build_app():
|
|
| 361 |
with gr.TabItem("โน๏ธ About", id="about"):
|
| 362 |
gr.Markdown(
|
| 363 |
"""
|
| 364 |
-
## About GameTheory-
|
| 365 |
|
| 366 |
### What is this?
|
| 367 |
-
GameTheory-
|
| 368 |
It was trained on the **GameTheory-Bench** dataset โ a collection of 2,913 computationally verified game theory problems.
|
| 369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
### Supported Problem Types
|
| 371 |
| Category | Description | Examples |
|
| 372 |
|----------|------------|----------|
|
|
@@ -378,18 +418,13 @@ It was trained on the **GameTheory-Bench** dataset โ a collection of 2,913 com
|
|
| 378 |
| ๐ค Cooperative Games | Coalition-based games | Shapley value, core, nucleolus |
|
| 379 |
| โ๏ธ Mechanism Design | Incentive design problems | VCG, revelation principle, IC constraints |
|
| 380 |
|
| 381 |
-
### Technical Details
|
| 382 |
-
- **Base Model:** [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct)
|
| 383 |
-
- **Training Data:** [2reb/GameTheory-Bench](https://huggingface.co/datasets/2reb/GameTheory-Bench) (2,913 verified problems)
|
| 384 |
-
- **Training Method:** Supervised fine-tuning with LoRA adapters
|
| 385 |
-
- **Solution Verification:** All training solutions computationally verified using nashpy and scipy
|
| 386 |
-
|
| 387 |
### How It Works
|
| 388 |
- **Browse Examples tab:** Shows pre-loaded problems from the dataset with verified solutions
|
| 389 |
-
- **Solve Your Own tab:** Sends your problem to Qwen2.5-7B-Instruct via the HuggingFace Inference API with
|
| 390 |
|
| 391 |
### Links
|
| 392 |
-
-
|
|
|
|
| 393 |
- ๐ [Dataset on HuggingFace](https://huggingface.co/datasets/2reb/GameTheory-Bench)
|
| 394 |
"""
|
| 395 |
)
|
|
|
|
| 39 |
"hard": "๐ด",
|
| 40 |
}
|
| 41 |
|
| 42 |
+
SYSTEM_PROMPT = """You are GameTheory-Reasoner, an expert AI system specialized in game theory analysis. You were trained in two phases โ Phase 1 (Solver) used supervised fine-tuning on computationally verified solutions, and Phase 2 (Reasoner) used Group Relative Policy Optimization (GRPO) with verifiable rewards to enhance step-by-step reasoning quality.
|
| 43 |
|
| 44 |
For every problem:
|
| 45 |
+
1. Think carefully and reason step-by-step through the problem before jumping to conclusions
|
| 46 |
+
2. Identify the game type and key components (players, strategies, payoffs, information structure)
|
| 47 |
+
3. Apply the appropriate solution concept (Nash Equilibrium, Subgame Perfect Equilibrium, Bayesian Nash Equilibrium, Core, Shapley Value, etc.)
|
| 48 |
+
4. Show complete step-by-step mathematical derivation with clear logical transitions between each step
|
| 49 |
+
5. Clearly state the final answer
|
| 50 |
+
6. Verify your solution by checking all equilibrium conditions are satisfied
|
| 51 |
|
| 52 |
Be precise with mathematical notation. Show all work. Format payoff matrices clearly using markdown tables when relevant."""
|
| 53 |
|
|
|
|
| 230 |
|
| 231 |
*An AI system trained to solve game theory problems with rigorous step-by-step reasoning*
|
| 232 |
|
| 233 |
+
[](https://huggingface.co/Alogotron/GameTheory-Reasoner)
|
| 234 |
+
[](https://huggingface.co/2reb/GameTheory-Solver)
|
| 235 |
[](https://huggingface.co/datasets/2reb/GameTheory-Bench)
|
| 236 |
[](https://huggingface.co/datasets/2reb/GameTheory-Bench)
|
| 237 |
"""
|
|
|
|
| 304 |
gr.Markdown(
|
| 305 |
"""Enter any game theory problem and get an AI-generated solution.
|
| 306 |
|
| 307 |
+
*Powered by Qwen2.5-7B-Instruct via the HuggingFace Inference API with the GameTheory-Reasoner system prompt, trained through SFT + GRPO reinforcement learning for enhanced step-by-step reasoning.*"""
|
| 308 |
)
|
| 309 |
|
| 310 |
with gr.Row():
|
|
|
|
| 363 |
with gr.TabItem("โน๏ธ About", id="about"):
|
| 364 |
gr.Markdown(
|
| 365 |
"""
|
| 366 |
+
## About GameTheory-Reasoner
|
| 367 |
|
| 368 |
### What is this?
|
| 369 |
+
GameTheory-Reasoner is an AI system trained in **two phases** to solve game theory problems with rigorous mathematical reasoning.
|
| 370 |
It was trained on the **GameTheory-Bench** dataset โ a collection of 2,913 computationally verified game theory problems.
|
| 371 |
|
| 372 |
+
### Training Pipeline
|
| 373 |
+
|
| 374 |
+
| Phase | Method | Model | Description |
|
| 375 |
+
|-------|--------|-------|-------------|
|
| 376 |
+
| Base | โ | Qwen2.5-7B-Instruct | Pre-trained foundation model |
|
| 377 |
+
| Phase 1: **Solver** | Supervised Fine-Tuning (SFT) | [GameTheory-Solver](https://huggingface.co/2reb/GameTheory-Solver) | Fine-tuned on verified solutions with LoRA adapters |
|
| 378 |
+
| Phase 2: **Reasoner** | GRPO (RL) | [GameTheory-Reasoner](https://huggingface.co/Alogotron/GameTheory-Reasoner) | Reinforcement learning with verifiable rewards for reasoning quality |
|
| 379 |
+
|
| 380 |
+
### Benchmark Results: Base โ Solver โ Reasoner
|
| 381 |
+
|
| 382 |
+
| Metric | Base (Qwen2.5-7B) | Solver (Phase 1 SFT) | Reasoner (Phase 2 GRPO) |
|
| 383 |
+
|--------|:------------------:|:---------------------:|:-----------------------:|
|
| 384 |
+
| **Overall Accuracy** | 82% | **94%** | **94%** |
|
| 385 |
+
| **Hard Problems** | 66.7% | 94.4% | **94.4%** |
|
| 386 |
+
| **Reasoning Quality** | 0.48 | 0.51 | **0.54 (+6%)** |
|
| 387 |
+
|
| 388 |
+
### Per-Category Breakdown
|
| 389 |
+
|
| 390 |
+
| Category | Base | Solver | Reasoner |
|
| 391 |
+
|----------|:----:|:------:|:--------:|
|
| 392 |
+
| ๐ฒ Normal Form 2ร2 | 100% | 100% | 100% |
|
| 393 |
+
| ๐ฒ Normal Form 3ร3 | 100% | 100% | 100% |
|
| 394 |
+
| ๐ฒ Normal Form 3ร4 | 80% | 80% | 80% |
|
| 395 |
+
| ๐ฒ Normal Form 4ร4 | 80% | 80% | 80% |
|
| 396 |
+
| โ๏ธ Zero-Sum Games | 100% | 100% | 100% |
|
| 397 |
+
| ๐ณ Sequential Games | 100% | 100% | 100% |
|
| 398 |
+
| ๐จ Auction Theory | 80% | 100% | 100% |
|
| 399 |
+
| ๐ฎ Bayesian Games | 0% | 100% | 100% |
|
| 400 |
+
| ๐ค Cooperative Games | 80% | 80% | 80% |
|
| 401 |
+
| โ๏ธ Mechanism Design | 60% | 100% | 100% |
|
| 402 |
+
|
| 403 |
+
### Phase 2: GRPO with Verifiable Rewards
|
| 404 |
+
The Reasoner model was trained using **Group Relative Policy Optimization (GRPO)**, a reinforcement learning method that:
|
| 405 |
+
- Generates multiple solution candidates per problem
|
| 406 |
+
- Scores each using **verifiable reward functions** (answer correctness, format compliance, reasoning quality)
|
| 407 |
+
- Updates the policy to favor higher-quality reasoning chains
|
| 408 |
+
- Achieves the same 94% accuracy as the Solver while producing **+6% better reasoning quality** (measured by structured reasoning metrics)
|
| 409 |
+
|
| 410 |
### Supported Problem Types
|
| 411 |
| Category | Description | Examples |
|
| 412 |
|----------|------------|----------|
|
|
|
|
| 418 |
| ๐ค Cooperative Games | Coalition-based games | Shapley value, core, nucleolus |
|
| 419 |
| โ๏ธ Mechanism Design | Incentive design problems | VCG, revelation principle, IC constraints |
|
| 420 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
### How It Works
|
| 422 |
- **Browse Examples tab:** Shows pre-loaded problems from the dataset with verified solutions
|
| 423 |
+
- **Solve Your Own tab:** Sends your problem to Qwen2.5-7B-Instruct via the HuggingFace Inference API with the GameTheory-Reasoner system prompt
|
| 424 |
|
| 425 |
### Links
|
| 426 |
+
- ๐ค [Reasoner Model (Phase 2)](https://huggingface.co/Alogotron/GameTheory-Reasoner)
|
| 427 |
+
- ๐ค [Solver Model (Phase 1)](https://huggingface.co/2reb/GameTheory-Solver)
|
| 428 |
- ๐ [Dataset on HuggingFace](https://huggingface.co/datasets/2reb/GameTheory-Bench)
|
| 429 |
"""
|
| 430 |
)
|